How do I show an object in a datagrid that has no association to another object?

5
In a datagrid I would like to show all objects except those object that do not have an association to a specific other object. I do know that I have to do this with Xpath, however, the following Xpath query does not work: [Module.Obj1-Obj2/Module.Obj2/Module.Obj1-Obj2 != '[%CurrentObject%]'].
asked
3 answers
5

Your form should look like this: Dataview of "specific other object" Obj1. Add a table to the dataview to show a datagrid of Obj2.

Set context of the datagrid to private and use:

[Module.Obj1_Obj2/Module.Obj1/id = '[%CurrentObject%]'] to show Obj2 objects with an Obj1 relation.

and

[not(Module.Obj1_Obj2/Module.Obj1/id = '[%CurrentObject%]')] to show Obj2 objects without an Obj1 relation.

answered
4

You would like to show all objects which do have a specific association? That is what I read in your question. Then you do not have objects which do not have an association to a specific other object. Well, you do it simply by the following constraint:

[Module.Obj1-Obj2/Module.Obj2/Module.Obj1-Obj2 = '[%CurrentObject%]']

Maybe, you would like to show all objects which do not have a specific association. Then you can use one of the following constraints:

  1. [Module.Obj1-Obj2/Module.Obj2/Module.Obj1-Obj2 != '[%CurrentObject%]']
  2. [not(Module.Obj1-Obj2/Module.Obj2/Module.Obj1-Obj2 = '[%CurrentObject%]')]

The first option also retrieves objects which does have an association with the specific object, but also with one or more other objects! The logic behind this is that there is an association with another object which is not equal to the specific object.

Only the second constraint retrieves the objects which don't have any association with the specific object.

answered
0

In your constraint you go grom obj1 to obj2 and back again, so that didn't work.

I think you need something like this: [not(Module.Obj1-Obj2/Module.Obj)] - That shows all Obj1 objects that haven't a relation to Obj2
or
[Module.Obj1-Obj2/Module.Obj2 != '[%CurrentObject%]'].

But in last case you need to drop context. I think that's the answer you needed. Because you want to show in the datarid only that objects that hasn't a relation to the [%CurrentObject%]. But your datagrid is contraint by context on [%CurrentObject%] (because your datagrid is in a dataview, otherwise you couldn't use [%CurrentObject%] token).

So without dropping context, you will get no results.

answered