How to assign Map sort parameter in the retrieveXPathQuery

6
refering to https://world.mendix.com/display/refguide/MendixObjects i'd like to know how to use Core.retrieveXPathQuery like this List<imendixobject> Core.retrieveXPathQuery(IContext context, String xpathQuery, int limit, int offset, Map< Sting, String> sort, int depth) how to assign map parameter how to assign type of sorting such as ascending, descending Thank you
asked
1 answers
5

Hi,

the key of each map pair should be the membername* on which should be sorted (example: "User.Name") and the value should be the sort direction, either "asc" or "desc". For example:

Map<String, String> sort = new HashMap<String, String>();
sort.put("User.Name", "asc");

Now you can pas the sort object to the retrieve method. (Do not forget to import java.util.Map and java.util.HashMap)

*you can use proxies for this, if applicable, for example : sort.put(system.proxies.User.MemberNames.Name.toString(), "asc")`

answered