You are viewing limited content. For full access, please sign in.

Question

Question

ADD versus SUM in Forms Calculations

asked on November 3, 2017 Show version history

If I have a table and am only trying to add 2 numbers, shouldn't ADD and SUM give me the same result in the equation?  I use =ADD(TableTest.FirstNumber, TableTest.SecondNumber) and it tells me there is an error.  But if I use =SUM(TableTest.FirstNumber, TableTestSecondNumber) it works fine.  Using Version 10.2.1.205

Note:  If I have 2 single line fields, ADD in the third works.  I only get the ADD error when I am trying to do it from a table.

Also how do I get it to add the rows separately instead of continuing to add all the rows together?

FormsTableCalculation.jpg
CalculateRows.jpg
0 0

Answer

SELECTED ANSWER
replied on November 3, 2017 Show version history

My guess would be that ADD can't handle a collection the same way as SUM, so when you try with a table it chokes expecting each item to be a single value. In a way, your two issues may be related.

To get a specific row, you need the INDEX function wrapped around each column variable. Replace your function with the following and it should start working correctly.

SUM(INDEX(TableTest.FirstNumber,ROW()),INDEX(TableTest.SecondNumber,ROW()))

What this does is tells it to use the Index of the column that matches the current row, so the total field in row 1 gets the values from row 1, and so on. I'm not sure, but this may fix the ADD error too, but I'd say SUM is the standard approach anyway.

0 0
replied on November 3, 2017

Thanks.  I got it to work when I took the ) out after TableTest.SecondNumber.

 

0 0
replied on November 3, 2017

Oops, yea that was a typo lol

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.