XPath selection on a higher association than current-object

0
Hi, My simplified situation: Three entities A (1-n) B (n-n) C (where C refers to B) So multiple C records can be assigned to a B record. Assume I have multiple A records with each several B and each several C records. All records have unique names. I have a grid for records of B and an MF button to assign C records. The MF opens a selection screen with XPath and should show all records that are already used in other B records but not in the selected B record. Excluding the already assigned to B record is no problem with [not(MyModule.C_B='[%CurrentObject%]')] But then I get also all C records that are part of other A records. So I should make this something like [MyModule.C_B/MyModule.B/MyModule.B_A='A' and not(MyModule.C_B='[%CurrentObject%]')] But 'A' is not available in the XPath. Any idea how I can get only the C records which are part of the "A-tree" without creating an extra association between A and C (1-n)? The issue is a bit similar to "Using associations in XPath Constraint" https://community.mendix.com/link/questions/8811 but is not really answered yet (to my opinion).  Thanks in advance.
asked
2 answers
4

If I understand your requirement correctly, you can use:

 

[not(MyFirstModule.C_B/MyFirstModule.B)]
[MyFirstModule.C_B/MyFirstModule.B/MyFirstModule.B_A/MyFirstModule.A/MyFirstModule.B_A = '[%CurrentObject%]']

 

The first constraint filters out all C objects which are already associated with your current B object.

The second constraint shows only C objects with a path to an A object (through some B object), but that A object has to be the one associated with your current B object.

answered
2

Hi Rom,

It is so simple that I don't understand why I did not find it myself.

It works fine!

Thanks

answered