Adding variables

I could use some help with adding variables.

This should be simple, but I’m struggling with the right approach.
I have four app variables that when selected generate the value of 1.
I now want to simplify this by creating the total value. So I created another app variable that is the sum of the four other app variable.

So for example app variable BallsB1 = (appVars.B1B1+1)+(appVars.B1B2+1)+(appVars.B1B3+1)+(appVars.B1B4+1)

I know the individual values work because I’ve tested all four, but whenever I try and use the BallsB1 variable, I get no value in return. I want this to be dynamic, meaning that when one of the variables are pressed, BallsB1 may be 1 through 4. All app variables are set to an initial value of 0.

I’ve tried page variables, data variables, but I’m sure there is a simple reason why this is not working but I can’t figure it out!

Any help would be appreciated. I’ve got a lot of variables to add so I thought creating a sum variable would be easy, but again I can’t figure out why it won’t sum individual variable items.

Thank you.


1 Like

Did you get an answer? I’m after the same thing. I have tried using the SUM function, but it only sums all the elements of an array, and I can’t work out how to get my 6 variables into an array…

Not really. It is not dynamically updating but I found a work around, but still not the ideal solution.

You basically have to create an event that when one of your variables changes, the sum updates. Kind of a pain, but it works.

1 Like

My workaround is instead of the desired button appearing when conditions are met, the user has to press a button to see if they are. Its not what I wanted, but fits the user flow close enough.