To sum and subastract values from Inputs

Hi guys,

Does anyone have any idea of how i can sum or subtract values from 3 inputs? It’s kind a little calculator where I have 3 values (3 inputs) and when I go inserting values in these inputs, automatically display a result value in a text field. How do i write the expressions of these Variables?

kind regards,

Eric.

Let’s imagine you have two text fields, Input1 and Input2, and that through some action you save the text on those fields to variable Input1Var and Input2Var.

If you want to display the sum of those two fields, you could use an action to set the text on some widget to: [[Input1Var + Input2Var]]

Use [[ ]] to encapsulate expressions. You can write full expression inside and even use common JavaScript math function. For example, [[(Input1Var + Input2Var).toFixed(2)]] to force two decimal places on the result.

Anything outside [[ ]] will be interpreted literally. [[Input1Var]]+[[Input2Var]] would result in something like “10+20”, not “30”

1 Like

Thank you Nathan!

how to sum All Column Please

Hi! It looks like your post was answered over on this thread, if you’d like to take a look! How to sum all column

I’m trying to do the above (but the action would be upon text input in any of three fields. Unfortunately what displays is [[Input1 + Input2 + Input3]] not the sum of the numbers in the fields. What am I doing wrong?

Hi Luxxer,

It looks like Nathan was able to help out over on the thread you posted:

Let us know if you have any other questions!

Nathan helped me but now I have a different but related question. I have created a new page, but with Axure tables, thinking this would be simpler. However, now I can’t figure out how to name an individual cell so that I can perform the above noted calculations.

Hi Luxxer,

You can do this by naming each table cell and then targeting the cell from the Axure interaction. So if you had a table with two columns and two rows, you can name each table corresponding to their column/row placement, e.g.:

C1R1 C2R1
C1R2 C2R2

And if you wanted the text on C2R2 to say, carry the sum of C1R1 and C2R1, then you can assign the text of those table cells to local variables to carry out the sum calculation, e.g.:

[[C1R1 + C2R1]]

I’ve attached an example file to demonstrate this. Please lmk if I misunderstood or you have any questions!

TableSum.rp (55.6 KB)

Thank you. I didn’t know this was possible so I actually started using a repeater. I build out the page with multiple repeater tables, and this is working fine. However I am stuck with another question: Calculating Sums from multiple repeaters

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.