Copy link to clipboard
Copied
Hi, I’m able to hide the zero in fields when fields have simple calculations, using as the last line: if (sum !==0) {event.value = sum;} else {event.value = ""}
I have a field named LessRetainage with an if/else formula, and the formula works fine, but I’m not sure how to hide the zero, I’ve tried various versions and the zero still appears, any advice on the syntax of a line that would hide the zero would be appreciated. Below is the formula:
var Contract = this.getField("TotalContractToDate");
var TCW = this.getField("TotalCompletedWorkStoredMaterials");
var Retainage = this.getField("LessRetainage");
if (TCW.value <=(.5 * Contract.value)) {Retainage.value = .05 * TCW.value} else {Retainage.value = .025 * Contract.value}
Thanks!
Copy link to clipboard
Copied
The script you provided works with numeric values which do not have currency symbols or Percentage symbols. The latest versions of Acrobat seem to accept your script even if there are currency symbols present.
With older versions of Acrobat we used the AFNumber_Format function to modify the displayed result to include the currency symbol or not display it.
Copy link to clipboard
Copied
Ass this at the end of your code:
if (Retainage.value==0) Retainage.value = "";
Find more inspiration, events, and resources on the new Adobe Community
Explore Now