xPath Distinct value

1
I seem to end up asking this more than once, so apologies, but so far no real answer has been provided. Is there any way in the xpath to constraint the list in a datagrid to only show one unique item out of several with the same details. E.g. I have a list of records with a code. Lets say Registration. The registration as a 1:m relationship with assessments table. I'm looking for a particular attribute (Rating) in assessments and because I know that the attribute will have the same value for the same registration, for example 5 assessments for registration REG123 will have the same detail in attribute Rating (3 star). I would like to just display one row of REG123 with first assessment record. I would like to do this without having to go around my existing tables and create new table to filter the data or add boolean flags, etc etc. [Rating cannot be part of Registration - legacy, no much we can do about] Basically is there a way to use a statement like in SQL ... DISTINCT to just return a unique value. Could LIMIT be used against a field?!... (just a thought). I know there are answers out there pointing at creating entities and filtering the data with microflows, etc. Although this has been done in the past, is not really efficient and having to create new objects so that we can display data is not really the way to do things. SO... how could we constraint to a unique value in xpath for a datagrid? Many thanks, LR.
asked
2 answers
2

You can do a select distinct in OQL. https://forum.mendix.com/questions/3360/Count-Distinct

You could create a report pane and show the distinct values.

answered
0

May be I am missing the exact point you want to achieve, but I think this should be doable with combining lists. Create a list of assessments. Retrieve all the assessments of REG123. Now loop over them and check if the attribute is already in the just created list. If not add else skip. In the end you have I think the list you want to show as a source for a form.

Or am I missing something?

Regards,

Ronald

answered