Use of create variable - Mendix Forum

Use of create variable

0

Hi, 

I have a scenario in which i have used create variable named “Boxnumber”, i have to use it to create another variable in the same microflow , say “assetid = Boxnumber + ItemNumber”. But i couldn’t find a way to use “Boxnumber” in another activity.

Kindly help

asked
5 answers
1

If you create the Boxnumber inside a loop, it will overwrite on each iteration. If you want to use the boxnumber variable for every iteration, you should place the following activity also inside the loop.

answered
0

To add to what Thomas and Roy already mentioned.

Variables created inside the loop are scoped (read available) to elements inside the loop. If you want to have variable updated by operations inside the loop you can simply create a variable outside (read before) of it and modify it inside of the loop.

Here is an example:

Obviously it’s just there to illustrate this particular problem, usually you would use AggregateAction to achieve it. 

answered
0

To add to Roy's answer: variables created inside a loop are only available inside that loop, next to the fact that they get overwritten on each iteration.

answered
0

here is the microflow, i need to use Boxnumber in the following activity

answered
0

Find it with hitting the @ . @Boxnumber

answered