I'm using LiveCycle ES2 to create an expense claim form. I have no trouble calculating the sum of all values in a column in a table with repeatable rows. However, this form is more complex. As you'll see, each item (expense) is a table. Clicking the button adds a new instance of the table. No problem with the calculation for GST, either.
Where it gets tricky is trying to dynamically calculate the grand totals for all expenses incurred and for all GST. This is in a different table, as you can see here.
And here's a grab of the object hierarchy that illustrates just how I built this.
Is this too complex, or is there a way to dynamically calculate the grand totals, regardless of how many instances of ExpenseDetails there may be?
Views
Replies
Total Likes
Nothing is too complex to calculate, using FormCalc should help you big time!
Using formCal for every instance should look something like this :
Sum($.resolveNode("ExpenseDetails").Row1[*].GST)
Row1[*] specify every instance of the object
Views
Replies
Total Likes
Hello, Magus069, and thank you for the reply. As you can see, however, it doesn't achieve the desired result.
Views
Replies
Total Likes
Can you show me your code?
Views
Replies
Total Likes
Unless I misunderstood your post, I put the line of code provided in the GST cell of the Labels row in the Totals table.
This illustrates the table, and that it's configured to be repeatable.
As indicated earlier, the Add/Delete buttons add/remove an instance of the entire table.
Views
Replies
Total Likes
I am not sure if this could fix it... but you might want to name your Subform that contains ExpenseDetails other than the table's name itself...
Code your AmtExclGST total too in the same way of your GST to see if there's any difference
Views
Replies
Total Likes
This doesn't appear to make a difference.
Views
Replies
Total Likes
Can you make another screenshot of the result, and use different values
Views
Replies
Total Likes
Views
Replies
Total Likes
Oh!!! okay geez, you create instance of your table with you parent Subform or with your table?
When you click Add Row, you are using instanceManager.addInstance(1) or insertInstance(x), when you write your calculate code line you must input this [*] on the object that you add instances too
Views
Replies
Total Likes
If Add row is clicked, add a new instance of ExpenseDetails table. Conversely, if Delete row is clicked, remove current instance of ExpenseDetails table.
These actions were built using the Action Builder, not code.
Can you let me know where the wildcard, [*], goes?
Views
Replies
Total Likes
can you show me the code written in add row click?
If I understand, it should be something like so:
Sum($.resolveNode("frmExpenseDetails").ExpenseDetails[*].Row1.GST)
but seeing you add row code should help, even if the action builder did it for you, there's should be some code in the click event
Views
Replies
Total Likes
Note that I've renamed the subform:
The code for the AmtExclGST is:
Sum($.resolveNode("ExpenseInfo").ExpenseDetails[*].Row1.AmtExclGST)
And the code for GST is:
Sum($.resolveNode("ExpenseInfo").ExpenseDetails[*].Row1.GST)
This worked!
Thank you very, very, very much!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies