Calculate data by multiplying and adding

Hi,

I have created a form to collect three numbers (income1, income2 and income3) and frequency for each income (weekly as 52 - annual equivalent, fortnightly 26, month 12 and annual 1)

all are of type number in the database,

I want to show the total in a repeatedgroup as: income1frequency1 + income2frequency2 + income3*frequency3

I tried to do the formula apparently the calculations is not correct, I am thinking of storing the data as calculated so that the sum comes as the annual, however, I still need to be able to change the total if a dropdown menu was selected to show weekly other than annual.

I thought of using states and updating states but that comes with challenges (I haven’t tried it),

I thought of storing the total (which ultimately is what I want to show, however that is not a good design and has its own issues.

I know that parenthesis are not supported in calculations, any ideas?

Sam

You can use Calculate formula when building expression for each of the three multiplications, and then sum them up.

If this won’t go, expressions elements in Toolbox plugin run javascript expressions. Even more general are html element where you can run js code in tags and show results, and js elements in Toolbox and some other plugins.

I have used the toolbox expression and it worked very well thank you,.

However I could not figure out how the calculate formula really works :slight_smile:

This topic was automatically closed after 70 days. New replies are no longer allowed.