Expand my Community achievements bar.

SOLVED

Dynamic repeating table How to sum total value?

Avatar

Level 2

user00799_0-1676262858752.png

 

user00799_1-1676262865956.png

 

 

Field 1. FormThirdPartyLogisticsRequest.frmBody.tblMain.rowSetSection.rowMain.colQuantity

Field 2.
I want it to appear in FormThirdPartyLogisticsRequest.frmBody.tblMain.footerRow.TotalQty .

In Field 2. after sub-table configuration
script 2.
sum(rowMain[*].colQuantity)
has been utilized.
However, the current value is output as 0.

Since I can't newly connect Binding in ALD and I have to solve it with the existing linked data, I have no choice but to use Script.

Data related to the value

Field 3.
Looking at the FormThirdPartyLogisticsRequest.frmBody.tblMain.rowSetSection.rowRemarkRow.frmBaseQuantity.decQuantity field, it contains the values I need to sum.

script 3.
if(this.rawValue <> null & this.rawValue <> "")
then
FormThirdPartyLogisticsRequest.frmBody.tblMain.rowSetSection.rowMain.colBaseQuantity.rawValue = FormThirdPartyLogisticsRequest.frmBody.tblMain.rowSetSection.rowRemarkRow.frmBaseQuantity.decQuantity.formattedValue
endif

Field 1 seems to be outputting the value of script 3.

At this time, what script should I use to output the sum of field1 to field2?

 

Best regards,

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I have checked your form, I added the below script in the mentioned field, and its working. 

 

FormPurchaseOrderConfirmation.PageA.tblTable.footter.GrandTotal::calculate - (FormCalc, client)
this.rawValue = sum(rowTableSection.rowTableItem[*].colQuantity[*]);

 

https://help.adobe.com/en_US/livecycle/11.0/DesignerHelp/WS92d06802c76abadb-5ec05741129b8b006dd-7fb9...

 

View solution in original post

6 Replies

Avatar

Community Advisor
var oFields = xfa.resolveNodes("Subform2[*].NumericField4"); 
var nNodesLength = oFields.length; 
var nSum = 0; 
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) { 
    nSum += oFields.item(nNodeCount).rawValue; 
} 
TextField1.rawValue = nSum;

You need to use script something like this for repeating table calculation. 

Avatar

Level 2

user00799_0-1676270948363.png

 

Thanks for the related script examples!

But would you please take a look at this before using that example?

I var oFields = xfa.resolveNodes("Subform2[*].NumericField4"); I think xfa() in is not working properly.

Please look at my screen. (simple test)

I think the value "total" should be printed in field 'nd'.
However, the value "Object162098848" is output.

Avatar

Community Advisor

You are putting the object reference in the field, not its values.

If you can share the forms on google drive (vkatoch07@gmail.com).

I'll have a look.

Avatar

Level 2

Thank you again for your comments!

 

I sent you email.

 

check plz!

Avatar

Correct answer by
Community Advisor

I have checked your form, I added the below script in the mentioned field, and its working. 

 

FormPurchaseOrderConfirmation.PageA.tblTable.footter.GrandTotal::calculate - (FormCalc, client)
this.rawValue = sum(rowTableSection.rowTableItem[*].colQuantity[*]);

 

https://help.adobe.com/en_US/livecycle/11.0/DesignerHelp/WS92d06802c76abadb-5ec05741129b8b006dd-7fb9...

 

Avatar

Level 2

A perfectly working script!

 

(Let's find out more about how to solve the object reference problem.)

 

And I also applied it to other forms that have the same table structure as that form.

But it doesn't work.

 

If possible, can I see my drive again?

 

* The differences between the two forms are as follows.
Quantity value using Binding function
imported from another subform