Hide Zero Values

Avatar

13-03-2009

In the "Invoice" template that comes with ES the "Amount" fields are blank unless there is a value in "Quantity" or "Unit Price". The only calculation is "Quantity * UnitPrice". How are the zero values hidden? I've looked at every field possible for some kind of hint as to what suppresses the zero values and I cannot find anything. My form that I am working on shows all zeros in the amount column, sure I could use the template but then I wouldn't learn anything.



Thanks in advance

Replies

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

13-03-2009

I assume that you are speaking of the Purchase Order sample. The 0 is showing up because you have a calculation on that field.



On the validation pattern (Edit), there is a checkbox that says allow empty. This in turn is firing the calc for the amount field and making it empty as well.

Avatar

13-03-2009

Paul,



Thanks for the quick response, I'm not so sure that we are talking about the same program as I do not have that choice when the field is selected. I am referring to the "Invoice Template" found when setting up a form from the "File" "New". When I select the field my only options under OBJECT are "Field, Value, Binding". Under the "Edit" menu at the top of the screen I do not have a "Validation pattern" This choice is availabe but grayed out on the "Object", "Value" menu due to the field being Calculated Read Only.



Thanks again in advance.

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

16-03-2009

You can get to the validation patterns from the Object/Field palette.

Avatar

16-03-2009

Ermm... may I help?



Do the calculation with Javascript in the amount field:

if (Quantity.rawValue != null && UnitPrice.rawValue != null)

{this.rawValue = Quantity.rawValue * UnitPrice.rawValue}



Hope that helped

Lisa



Edit:

Equivalent for the total Amount:

if (Amount1.rawValue == null && Amount2.rawValue == null ...)

{this.rawValue = null;}

else

{this.rawValue = Amount1.rawValue + Amount2.rawValue ....;}