Based on your feedback above (you want to retrieve it in one retrieval activity), the best way I can think of to do this is through a Java action that simply builds the retrieval XPath by iterating over the list of Employee IDs (or receives it as a String parameter) and uses the Java function retrieveXPathQuery (refer to this link for the documentation: https://apidocs.mendix.com/7/runtime/com/mendix/core/Core.html ).
Let me know if you require additional help or clarification.
If it‘s possible to iterate over the list of IDs that you have then you can just create an empty list of employees before the loop, and then while iterating over the IDs retrieve the employees one by one and add them to the employees list.
Let me know how does the list of IDs look like if you‘re facing a difficulty iterating over them.
*Edited* Short answer: use OQL. see end of this story for details. *End of Edited*
Only possible in a nasty way:
- create an importmapping that transforms the string into a list of EmployeeId’s
- create a variable for each employeeId via this microflow:
- create the Xpath-contraint to this
[ contains(EmployeeID, $Id1) or contains(EmployeeID, $Id2) or contains(EmployeeID, $Id3) ]
This is the only way that I can get it done but it would not get past my own peer-review, for one reason: you need to adjust the code to the maximum number of items in the given employeeId-list. Also it will be relatively slow to start with and exponentially slow with greater number of records.
Also, this question shows an example of Mendix being a totally inadequate tool for the job at hand. All the requirement asks is to generate this where:
SELECT id, dateofbirth, socialsecuritynumber, phone, employeename, employeeid, bankaccountnumber FROM public."forumquestions$employee" WHERE employeeid IN ('001','002');
Hm, can OQL save the day here? … Yes it can! See https://modelshare.mendix.com/models/f81b285f-bd8f-4f63-8322-3ff5b19a2b1f/sub-employee-get-by-array-of-employee-id
And as example, mydemoversion8-sandbox.mxapps.io → forumquestions → Question95038. In the string enter a valid list for the where clause without the ( and )