Currently it is not possible to loop over lists of variables, or even to create lists of variables. What I would like is the possibility to create and loop over lists of variables, like you would in most modern programming languages (see the simple example below).
pizzas = ["Pepperoni", "Caprese"] for pizza in pizzas: print(pizza)
This would be really helpful in a number of situations. For example, I am building a sports competetion application and I want to be able to return a string to indicate the placing of an athelete, for example "athlete x came in first". Currently I would have to create a microflow with an exclusive split for each placing, and if athlete/placing = 1 then return "first". What I would like to do is this:
rankings = ["First", "Second", ...] return rankings[athlete/placing]
without having to create an exclusive split for each value of the rankings I want to display.
Also see here: https://forum.mendix.com/link/ideas/147
I think this is especially useful when clients are migrating older data to a new Mendix app, or in other situations where you are importing external data. You simply can't always control the data is coming in and sometimes you need to split a string and loop over it.
In my six years of Mendix modelling, the only use case where this would have had any added value was iterating over enums. That is something that could be made available in the modeler. Anything else is so uncommon that it can fairly easily be solved in Java (which is also how I iterate over enums nowadays).
Yeah, I needed a simple example, but I agree, this is not the best example. One of the biggest reasons I want it personally is to make it easier to test a set of test cases in a set of unit tests, which is a lot of manual work right now. I would like to be able to define an test case array and a validation array, testing all possible test cases in just a few blocks.
While I agree with you suggestion, your example would be better solved by having an enum with properties. This enum would be called Ranking, and would have the properties number and description. You could then lookup the textual description by the number.