Dynamic repeating table How to sum total value? | Community
Skip to main content
New Participant
February 13, 2023
Solved

Dynamic repeating table How to sum total value?

  • February 13, 2023
  • 1 reply
  • 1298 views

 

 

 

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,

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Vijay_Katoch

Thank you again for your comments!

 

I sent you email.

 

check plz!


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.2.html

 

1 reply

Vijay_Katoch
New Participant
February 13, 2023
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. 

user00799Author
New Participant
February 13, 2023

 

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.

Vijay_Katoch
New Participant
February 13, 2023

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.