Skip to main content
Known Participant
September 3, 2025
Answered

Do calculation and don't show if zero

  • September 3, 2025
  • 2 replies
  • 208 views

I have a text field, called T1, with a formula in the Simplified field notation box.  The formula is to take a number entered in another text field, T2, and multiply it by 5.  The formula is T2*5.  If there is no number entered in T2, I would like to hide the zero in T1.  Normally, I would enter the following as a Custom calculation script in T1:  if(event.value == 0) event.value = "";

But, I can't use both a Simplified field notation and a Custom calculation script in T1.  Any ideas?  Thanks.

Correct answer try67

Or simply use a custom calculation script:

 

var t2 = Number(this.getField("T2").valueAsString);
if (t2==0) event.value = "";
else event.value = t2*5;

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
September 3, 2025

Or simply use a custom calculation script:

 

var t2 = Number(this.getField("T2").valueAsString);
if (t2==0) event.value = "";
else event.value = t2*5;
Known Participant
September 3, 2025

Thank you!

PDF Automation Station
Community Expert
Community Expert
September 3, 2025

Leave your simplified field notation, and enter your script as a custom format script.