I am creating an invoice form where I've put in the calcuations to generate an amount for the "Amount" field. However, it's showing 0.00 where the "Amount" field is zero. How do I make it that it shows nothing when it's zero. I tried using the following script in the Custom Calculation Script under the calculation tab.
Amount2.value = this.getfield("Qty2").value * this.getfield("UP2").value;
if (Amount2.value == 0) Amount2.value = "";
When inputting this, the field just becomes blank.
Can anyone help meÉ
Use this code instead:
var amount = Number(this.getField("Qty2").value) * Number(this.getField("UP2").value);
event.value = (amount==0) ? "" : amount;
Yes that works!
Setting the output to an empty string only works if a real number value is not needed by another calculation or as an export value. If either of these is the case, then I'd suggest using a format script to blank the field. Format scripts only affect the display of a field and don't change the real value.