Assign the value of a variable that is inside a loop to another variable that is outside.

0
Hello all Mendix developers I have a variable 1 inside a loop, I want to use the value of variable 1 in a variable 2 that is outside the loop, that is to say, to assign the value of the variable inside the loop to the variable that is outside the loop. Thanks.
asked
1 answers
1

You can use a Change Variable action inside the loop to set the value of $Variable2 to be that of $Variable1. $Variable2 will need to be declared before the loop, and remember that it will only hold the last value of $Variable1 before the loop ends. You won't have any other values that $Variable1 may have held in the loop unless you specifically append them to $Variable2 in the Change Variable action.

 

https://docs.mendix.com/refguide/change-variable/

 

I hope this helps.

answered