Highlighted

If Expression problems

Avatar

Guest

03-02-2009

Specs: running LiveCycle Designer 8



setting an expression statement to a numeric field



if (NDays<=2) then

(NCost/2)*NDays

else if (NDays>2) then

(NDays-2)*NCost+NCost

endif



NDays and NCost are two other user entered fields.



I put this statement in the calculate event with Formcalc as the language and Client as the run at. The goal here is for the user to enter a cost per day and how many days their trip is, and for this if statement to automatically calculate the total. The formula is supposed to represent the fact that the first and last days of a trip, you recieve half of the usual allotment.



Ok, now with all this set. When I open the saved form with reader or pro, i get a "syntax error near token endif on line 5, column 5" and I have no idea why. I am wondering why this script is running at initialize if it is set in the calculate event....



any help would be apreciated!

Replies

Highlighted

Avatar

Guest

04-02-2009

I'm encountering the same problem and I even copied and pasted the example from the help screen and changed the fields and values.
Highlighted

Avatar

Guest

02-03-2009

Hi Vincent & Marlon - The syntax error is that you've got two if statements, but only one endif. Try adding another endif at the end.