내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

Sum of numbers when dropdown is answered as YES

Avatar

Level 1

I need the sum of a column of numbers only when the dropdown is answered as Yes.  Table 3, row 2, "Dropdown" is a dynamic field where the user will answer Yes or No to a parameter.  If they answer yes, I need to add the column on Table 3, row 2, cell "Amount" together for a sum.  In addition, they have the option to add unlimited rows to the table.  I have not been successful in writing script to add all of the "Amount" cells on this table that have the answer yes and ignoring all the cells that have "no".  Any help would be appreciated.

LISAHA3_0-1687445443663.png

 

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Community Advisor

In your existing script, I did below changes and it is working for dropdown value. You can add similar to other fields.

 

form1.#subform[0].#subform[1].Subform6.#subform[0].#subform[3].Table3.TotalSubs.NumericField1[0]::calculate - (FormCalc, client)
if(Row2.DropDownList.rawValue == "YES") then
$.rawValue=SUM(Table3.Row2[*].Amount);
endif

원본 게시물의 솔루션 보기

5 답변 개

Avatar

Community Advisor

Share the form @ vkatoch07@gmail.com. I'll have a look.

Avatar

Level 1

Sent it to you, thanks

Avatar

Community Advisor

I saw your form, so the solution should be like below.

 

You can write a javascript function that should be called

> When you delete a row,

> On change of dropdown value

> And amount and percentage field exit

 

This function should have the below logic:

 

It should loop through all row in the table and inside the loop you need to check the dropdown YES/NO condition and then add the amount and percentage value and set it to the total fields.

Avatar

Level 1

The script I am writing is failing to calculate that number.  I'm looking for the proper script language, that will calculate that sum.  Thanks!

Avatar

정확한 답변 작성자:
Community Advisor

In your existing script, I did below changes and it is working for dropdown value. You can add similar to other fields.

 

form1.#subform[0].#subform[1].Subform6.#subform[0].#subform[3].Table3.TotalSubs.NumericField1[0]::calculate - (FormCalc, client)
if(Row2.DropDownList.rawValue == "YES") then
$.rawValue=SUM(Table3.Row2[*].Amount);
endif