Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Calculate repeating rows

Avatar

Level 7

My table name is details

the repeating row name is detail

the column name is Amount

I have a separate numeric field (does not included in the table) with the name TotalAmount

How I will calculate the Amount of the repeting rows for the TotalAmount field?

Thank you

12 Replies

Avatar

Level 8

In the calculate event of TotalAmount where the language is FormCalc:

sum(details.detail[*].Amount)

Kyle

Avatar

Level 7

Thanks for your help

I am getting an error:

accessor 'details.detail[*].Amount is unknown.

Avatar

Level 7

Also maybe something to consider  abouth the error

the totalAmount field does not belong in the same subform

where the reapeting rows exists!

Avatar

Level 5

This might be because of the path which you specified in the Sum(***) function.

Click on amount field and copy the whole path and put it in Sum function.

Example :

sum(form1.page1.details.detail[*].amount)

Vjay

Avatar

Level 7

Thank you Vjay!

One step ahead..

I use your script,does not genarate any error and give me the amount os the first(default) row.

But when I add another instance the amount remain the same(as first row).

I am using the script: 

sum(form1.page1.details.detail[*].amount)

Also I tried another script without success:

sum(form1.page1.details.detail[*].amount[*])

What I am missing?

Thank You

Avatar

Level 5

You kept this

sum(form1.page1.details.detail[*].amount)

on calculate event of the amount field and Language - FormCalc?

Vjay

Avatar

Level 7

Yes, calculate event and Lang. Form calc

Avatar

Level 5

I tried it and its working for me.until i see the form cnt tel exact issue. Can you mail me ur form to muchukotavijay@gmail.com so that i can look into it.

Vjay

Avatar

Level 5

I didnt know that you are repeating All_A subform also.

Change the script on the amount field to  

sum(form1.PageA.ALL.All_A[*].details.detail[*].numAmount)

Then it works.

Vjay