Expand my Community achievements bar.

SOLVED

Getting the grand Total from an unknown number of instances

Avatar

Level 2

Hi all,

I have a form with a table and add/delete buttons. The “add” button adds another row-instance of this table.

The last cell in each row (“Cell_10") gives the total of all the data that was entered in that raw (Cells 1 to 9).

Above this table I have a numeric field, the “Grand_Total”, which needs to show the total of all the "Cell_10” instances (Table.Row2.Cell_10 ). Users may add as many instances as they want by using the add button (5 rows, 10 rows..., all with the Total in their respective Cell_10).

Could someone tell me what is the code for adding up all these instances?

Thank you.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

This is one of those instances where FormCalc is good. The expression to get at each cell10 assuming that they are in a Row subform woudl be Row[0].Cell10, Row[1].Cell10, Row[2].Cell10 ......

So you can use a wildcard occurance number to get all of them. So the expression woudl be:

Sum(Row[*].Cell10)

Make sense?

Paul

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

This is one of those instances where FormCalc is good. The expression to get at each cell10 assuming that they are in a Row subform woudl be Row[0].Cell10, Row[1].Cell10, Row[2].Cell10 ......

So you can use a wildcard occurance number to get all of them. So the expression woudl be:

Sum(Row[*].Cell10)

Make sense?

Paul

Avatar

Level 2

It works! Thanks a lot Paul.

Could you please help me with another simple question which I posted here: http://forums.adobe.com/message/2446358#2446358

Check Box - JavaScript Problem?

Here is the code I am using:

if(TableA.A.rawValue !=1)

{

    this.presence = "hidden";

}

else if(TableA.A.rawValue == 1)

{

    this.presence = "visible";

}

When the user  checks the box the comments textbox is visible (else, it isn't visible).

The problem is that when the textbox is visible, the  user is unable to enter any text. What am I missing?

Thanks.

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] ----