In my app data, I have three columns: {X}, {Y}, and {Sum}. {X} and {Y} have numbers 1-100. {Sum} is blank.
On the front end, I have a repeating group that displays randomized questions. I need the following rules to be true:
Sum < 100
Y > X
X + Y = Sum
Sum - Y = X
So, in question #2, the following should be true: 29 + 51 = 80, but as you can see, the sum is coming to 2. I believe this is because my {Sum} in Screenshot #2 is pulling new random numbers for {X} and {Y}, not the random numbers generated for {X} and {Y} in the question.
How can I take the random numbers in each question and find the sum?
I hope this makes sense. Thanks in advance for your advice!
Ah this is interesting
I didn’t completely understand how the app data plays into it.
But I do see how the calculation is misfiring.
One thing I can suggest is storing some of the data on groups to make things easier.
Here’s what I mean:
within your RG, create 1 main group for the cell.
Within this main group create 2 child groups. If you can’t incorporate these into your design, you could simply make them 1X1 pixels - essentially invisible.
That will let you set the data type on these groups as ‘number’ and you can dynamically assign one value to each group. So maybe the value of X goes onto child group 1 and the value of Y goes onto child group 2. Being dynamically assigned, you could even assign the value of X and Y based on your conditions (Y>X, X+Y=SUM, etc)
Now your calculation becomes way easier, since you just have to refer to group 1’s number and group 2’s number.
Boosting this - I was able to create two groups of two randomly-generated numbers that follow these rules. The problem is that the numbers are the same in each row of the repeating group - a problem for quizzes.