Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

dreaded default zero in calculated field - how to suppress until data entered

Avatar

Level 2

I am not experienced at scripting in LiveCycle Designer ES2.

This is what my PDF fillable form looks like when it is opened by the user:

Form.PNG

But, I don't want the default to be $0.00 as some users may print the form and will enter manually in all fields. I want it to be empty until data is added in any one of Hourly Rate or Total Contract Hours.

Capture.PNG

This is the form design with Object Binding tab (and Data Binding as Use Name() of:

TtlHrs

HrlyRate

VacRate (this is a protected field to set default value to .04; seen as 4% on form when it opens)

This is the simple calculation in FormCalc for the TOTAL field:

TtlHrs * HrlyRate + (TtlHrs * HrlyRate * VacRate)     which yields the default 0 in the form.

I want to write a script that will suppress the 0 until data is entered in either of the first two fields. I've tried using code suggested in other posts but it doesn't work - just keep getting syntax errors.

If you respond, please indicate whether your script is for teh claculate event for Java or FormCalc.

1 Accepted Solution

Avatar

Correct answer by
Level 7

Your calculation in formcalc should be something like:

if (TtlHrs.isNull == 0 and HrlyRate.isNull == 0) then

$ = TtlHrs * HrlyRate + (TtlHrs * HrlyRate * VacRate)

else $ = ""

endif

View solution in original post

3 Replies

Avatar

Correct answer by
Level 7

Your calculation in formcalc should be something like:

if (TtlHrs.isNull == 0 and HrlyRate.isNull == 0) then

$ = TtlHrs * HrlyRate + (TtlHrs * HrlyRate * VacRate)

else $ = ""

endif

Avatar

Level 10

Hi,

you can use the null and zero patterns to keep the field blank if its value is null (empty) or 0.

Display Pattern:

null{}|zero{}|num{zzzzzzzz9.99 $}

Avatar

Level 2

Thnaks a bunch. Worked and along with other reply, I learned a bit more today.