Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Form Calc

Avatar

Level 2

I have some fields that total, I want the the field to show no more that 50 even if it is higher.  How do I write the if the totals of the 4 fields is greater that 49 then show 50 in this field?

2 Replies

Avatar

Employee

Let's say you have got the value of total in a variable say numTotal. You want to display it in a field named numField1. You can write a formCalc or javascript to do that. Below is an example of how to do it through formCalc script:

if (numTotal > 49) then

form1.sf1.NumField1.rawValue = 50

else

form1.sf1.NumField1.rawValue = numTotal;

endif

Avatar

Level 2

Hi thanks for your response,  here is what I ended up with and works perfectly

this = DropDownList1 + DropDownList2 + DropDownList3

if (this>49) then

this = 50

else

this = this

endif

Thanks again