Loop in microflow

0
Hi all. I am new in Mendix. I am creating entity using microflow. Additionally i want to relate 4 sub-entities for the new one. In the microflow i get paramter of type new created entity. Now i want to loop 4 times and create 4 records in sub table and assign them to new entity. How can i do this using microflow? I have seen some exmaples and always in the Loop iterator i have to use list of entites. But i have no list before creating? Scheme looks like this : entity(1) --> sub-entity(*) Any idea how to solve it? Regards, Lukas
asked
1 answers
5

What you can do is provide an integer in your create microflow that determines the amount of times you want to loop. Additionally you create a counter variable in your microflow followed by a merge flow. From here on you continue your flow to create the first sub-entity. At the end of your flow you do a check where you check if Counter = <provided int="">. If this Resolves to true then you quit your microflow and if it is false you return to the first merge event. In the return flow you then change your variable counter to Counter = Counter+1.

This way you create a more traditional loop as used in programming.

Edit:

Click here to view full size

answered