Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Hide Zero Values


Former Community Member
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
4 Replies


Former Community Member
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.


Former Community Member

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.


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


Former Community Member
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



Equivalent for the total Amount:

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

{this.rawValue = null;}


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