11 Replies Latest reply: May 25, 2016 5:57 AM by Andrea Cristiano

# set multiple variables

HI guys I need your help.

I could do this:

I would like to do these actions, in this order:

1. save a value in a variable;
2. use the value of this variable to calculate a value of another variable.

A simple example:

1. x = 15
2. y = 2 * x

At the and x = 15 and y = 30

Everything should be done when I clik a button.

I create the button and set the actions, but the point number 2 doesn't work.

If I press the button twice evrything works, but I want press only one time.

How can I do?

• ###### Re: set multiple variables

Why don't you use

y = 2 * 15

or

y = 2 * Expression you are using to Set x

• ###### Re: set multiple variables

I can't use

y = 2 * 15

because x value can change

x value will be insert by the user

I don't know how I can recover the value from input form, without using a variable

• ###### Re: set multiple variables

Will be inputted using an input box?

• ###### Re: set multiple variables

User can insert the value by the input box, and I will use that value

• ###### Re: set multiple variables

So then you don't really need the button to set the value for x. You just need to it to change y based on the new x value. No? Try the attached

• ###### Re: set multiple variables

I need button because I have many variables, and algorithm doesn't work without all values

The idea is

1. insert all values
2. clik button
3. algorithm starts

But the results it's incorrect, and I have to press button twice

• ###### Re: set multiple variables

Would you be able to share a sample to see what exactly you are doing?

• ###### Re: set multiple variables

Ok, this is a simple example.

If you want want the profit, you have to push start button twice.

• ###### Re: set multiple variables

So this is what I was trying to suggest. Instead of using this ->

=num(total-(total*tax),'#.##0,00 \$'),

why can't you just use this ->

=num(weight*price-(weight*price*tax),'#.##0,00 \$')

• ###### Re: set multiple variables

I'm not sure if my adjustments could resolve all your needs but you will get another idea which could be combined to your approach.

The problem are the calculations within the variable which won't fire any trigger if the calculation-result changed. Therefore I set a OnChange-trigger on the variable weight which then set the variable-values (your combining variable-expression) for the other variables each time the variable changed.

- Marcus

• ###### Re: set multiple variables

Thank you to all.

At the end I used Sunny solution