Xpath- constrains for reference selector

0
hi all, i have a reference selector which i am calling via database.  i need to get the list values  from a constrain related to the associated entity.  for eg. i have an entity A( att1 as attribute)  and B ( att2 as attribute ) i need a constrain like this  [att2= $A/att1 ] where i get list of B whose att2 have same values of that of att1 from B. how do i achieve this ?  (I am not getting right results when i use a association to pull it . Like [A_B/A/att1= att2] hence i guess i should use '[% currentobject%]' as  A is the current object but not sure how)
asked
2 answers
2

First, change your data Source from Database to Xpath.  Then you can enter an Xpath constraint.  However, this will only probably wortk as you expect if the objects have been saved.  If possible, instead use the Constrained by attribute to select the chain of associations to restrict your data, like:

answered
1

Hey Rachana, the Mendix Client doesn't support XPath constraints based on attributes, only based on objects ('[% currentobject%]') and associations. So it isn't possible to select: [A_B/A/att1 = [% currentobject%]/att1]  Only fixed values are possible: [A_B/A/att1 = 'FixedValue']

To achieve what you want is only possible by selecting the datasource to Microflow and do a database retrieve there and then you can but constraints based on attributes. This gives some disadvantages because searching and sorting isn't possible anymore in a datagrid. Check the documentation here.

I hope this helps, good luck!

answered