Expand my Community achievements bar.

Suppressing Zeros in Calculated Fields

Avatar

Former Community Member
I am designing a form that has calculated fields much like an invoice voucher. The first column is number of units (pages). The second column is units multiplied by $1.80 (price per page). I know how to write the script to calculate; however, I want the total to be blank if there is no amount entered in column one. More or less, I want to suppress any zeros. I have set this up so many different ways and nothing has worked. It seems that as long as there is a value in one side of the calculation, the total field will show $0.00. Does anyone know how to suppress a field if it equals zero?



Here's what I am doing:

Column 1 - numeric field (pages1)

Column 2 - numeric field (costpages)

In FormCalc: pages1 * 1.80



It is an invoice voucher with several columns. They might have need to use one row or 10 rows. If they only need one row, the remaining nine rows show $0.00 in the column all the way down. I just want them to be blank.



Any help would be appreciated!
1 Reply

Avatar

Former Community Member
Here's how I did it:

1) Field: type : Numeric Field, Display Pattern Z,ZZ9.99, no edit pattern;

2) Value: Calculated - Read Only

3) Binding: Normal, no data pattern, Data Format: Decimal

4) Add the following FormCalc script to object's calculate event:

if (quantity == 0 or quantity == Null) then

(Null)

else

(quantity * cost)

endif

// where quantity is the number of items ordered, and

// where cost is the unit cost of the item.