Expand my Community achievements bar.

SOLVED

Summing Field not Updating

Avatar

Level 3

I have a dynamic page and table.  The table has a button to add additional rows.  There is a total section on this table that uses a "for" loop to sum up the values of one of the columns.  I have a button that when pressed copies the page, which also then creates a new instance of the table.

When I add a page via the button, it inserts fine.  The problem is that if I have x rows in the first table and >x rows in any of the other tables, the summing box will only add the first x rows of the additional tables.  Basically, I think the "i" variable is being used from the first table.  The work around is to add addtional blank rows to the first table to increase the i value, however, this only helps prove the problem and doesn't provide a solution.  I was curious if anyone might know how to fix this.

Thanks in advance,

Mallard27

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

There is a tendency to over complicate tables created to behave like spreadsheets. FormCalc is an extremely powerful tool that addresses these problems very nicely, and more importantly, easily.

For example, consider a footer row and a calculated - read only field called 'fixedCostTotal',

// form1.page1.subform1.table.footer.fixedCostTotal::calculate - (FormCalc, client)

$.rawValue = sum(form1.page1.subform1.table.row[*].fixedCost)

Take a look at the attached and see if it helps.

Steve

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

There is a tendency to over complicate tables created to behave like spreadsheets. FormCalc is an extremely powerful tool that addresses these problems very nicely, and more importantly, easily.

For example, consider a footer row and a calculated - read only field called 'fixedCostTotal',

// form1.page1.subform1.table.footer.fixedCostTotal::calculate - (FormCalc, client)

$.rawValue = sum(form1.page1.subform1.table.row[*].fixedCost)

Take a look at the attached and see if it helps.

Steve

Avatar

Level 3

WOW!!!

That is so much simpler AND IT WORKS!  Thank you so much.  I was using the for loop from previous help on another form but this is far simpler and works to boot.

Thanks again for the great help!

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----