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?
Nothing is too complex to calculate, using FormCalc should help you big time!
Using formCal for every instance should look something like this :
Row1[*] specify every instance of the object
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.
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
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
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?
can you show me the code written in add row click?
If I understand, it should be something like so:
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
Note that I've renamed the subform:
The code for the AmtExclGST is:
And the code for GST is:
Thank you very, very, very much!