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

Endif prevents formcalc process

Avatar

Level 3

I finally figured out how to remove the syntax errors with endif. The problem is now I have no more errors and those fields no longer calculate.

Example for a loan payment: The field requires other fields to calculate so "endif" was needed. The other fields are zero until I fill the form.

 

 

if(Pmt>0) then Pmt(LoanTotal, Blendrate / 1200, Term * 12) (Taxes + Ins + HOA)endif

Payment calculated perfectly prior to "endif" as follows. (LoanTotal, Blendrate / 1200, Term * 12) (Taxes + Ins + HOA)

Not sure how this can be fixed? The form works great, but I hate all the syntax errors.

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 7

the if condition should be something like:

if (LoanTotal > 0 and Blendrate > 0 and Term > 0) then

otherwise you would get a division by 0 error.

View solution in original post

4 Replies

Avatar

Correct answer by
Level 7

the if condition should be something like:

if (LoanTotal > 0 and Blendrate > 0 and Term > 0) then

otherwise you would get a division by 0 error.

Avatar

Level 3

Thank you for the help! the code below is what  i've placed in the calulate event in formcalc. It still doesnt work. Is it becuase Ignored the Taxes, ins and HOA?

 

If(Pmt > 0 and Blendrate > 0 and Term > 0) then Pmt(LoanTotal , Blendrate / 1200, Term * 12) + Taxes + Ins + HOA;

endif.

Is there a way to do equal (=) to or greater than(>) also?

Avatar

Level 3

I figured out the greater than or equal to thing. Still working on the Pmt.

Thanks again.

Avatar

Level 3

Got it working, thank you! Now lets see if if can get the color coded properly.