Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Need help with formula: Calculating subtotals in offers (using Adobe Livecycle Designer)

Avatar

Level 2

Hi community,

I'm just trying to create a xdp template for a customer. I am a total beginner when it comes to Adobe. Everything works fine except the subtotal field. It would be great if you could help me out with the right formula. Here's what I got so far...

Table design:

1996531-tabelle.jpg

"Euro" field (DecBetragNetto): visible, decimal field, read only, binding works
"Dezimalfeld" field (subtotal field named "Sum"): visible, decimal field, calculated - read only, no data binding

Page structure:

1996532-struktur.jpg

 

Output:

1996533-ausgabe.jpg

This is just an example output screenshot which calculates the sum of line 1.* I thought that my problem could be solved using Sum(xfa.resolveNode("FormQuoteNotification.bdyPage1.SubFrmTble.Table1.Row1[*].DecBetragNetto[*]")) but the output field stays empty.

Please help.

 

*Formula: Sum(xfa.resolveNode("FormQuoteNotification.bdyPage1.SubFrmTble.Table1.Row1.DecBetragNetto"))

1 Accepted Solution

Avatar

Correct answer by
Employee

You need to execute a loop through all the table rows like this and calculate the Total, something like this in JS:

 

 

var rows = this.resolveNodes("FormQuoteNotification.bdyPage1.SubFrmTble.Table1.Row1[*]");
total = 0;
for(var i =0; i<rows.length;i++)
{
total= total+rows.item(i).DecBetragNetto.rawValue;
}
FormQuoteNotification.bdyPage1.SubFrmTble.sum.rawValue=total;

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

You need to execute a loop through all the table rows like this and calculate the Total, something like this in JS:

 

 

var rows = this.resolveNodes("FormQuoteNotification.bdyPage1.SubFrmTble.Table1.Row1[*]");
total = 0;
for(var i =0; i<rows.length;i++)
{
total= total+rows.item(i).DecBetragNetto.rawValue;
}
FormQuoteNotification.bdyPage1.SubFrmTble.sum.rawValue=total;