Copy link to clipboard
Copied
Good day!
I have a computed field that I made "Read Only" because the value that will be displayed in this field should show the result of a mathematical formula. Currently, when you open the PDF file, what it displayed is $0.00 even if I have not inputted anything on the two operants.
Example:
F01001b = blank (no value entered yet)
F01001c = blank (no value entered yet)
F01001d = computed field with formula F01001b*F01001c
I wish that field F01001d should display blank and not $0.00 when no value is entered in F01001b and F01001c.
Thank you again for your effort in coming up with a solution to this request.
As validation script of that field, use this:
if(event.value == 0)event.value = "";
Copy link to clipboard
Copied
As validation script of that field, use this:
if(event.value == 0)event.value = "";
Copy link to clipboard
Copied
Hi Nesa,
Thank you for always being there to help me with my issue. Very much appreciated.
Copy link to clipboard
Copied
This did not work for me. It actually produced a 0 once the calculation was run?
Copy link to clipboard
Copied
I need it to be blank unless a calculation is run in the associated fields.
Copy link to clipboard
Copied
The script did not produce 0 your calculation did.
You got answer on your second post for your calculation, if you use that script and this one correctly you will get desired result.
Copy link to clipboard
Copied
It should not have been 0 with what I entered in the other fields it should have been a number greater than zero. But, I'm trying it again today and it still shows a negative value in the field without entering in any data instead of remaining blank. I'm still new to this so I appreciate the support! Here's the script:
event.value = Number(this.getField("Remaining Balance 1").valueAsString) / Number(this.getField("Divide by 2").valueAsString);
Copy link to clipboard
Copied
Try this script:
var f1 = Number(this.getField("Remaining Balance 1").valueAsString);
var f2 = Number(this.getField("Divide by 2").valueAsString);
if(f1&&f2)
event.value = f1/f2;
else
event.value = "";
Copy link to clipboard
Copied
That did not work either 😞 Sigh...
Copy link to clipboard
Copied
Where did you put the script?
Did you check that field names are correct?
Share your file, so we can see what is going on.
Copy link to clipboard
Copied
Sorry, I was out of the office for a bit. I tried putting this in the custom calculation script under validate tab and then also tried putting it in the calculate custom calculation script.
var f1 = Number(this.getField("Remaining Balance 1").valueAsString);
var f2 = Number(this.getField("Divide by 2").valueAsString);
if(f1&&f2)
event.value = f1/f2;
else
event.value = "";
Copy link to clipboard
Copied
Copy link to clipboard
Copied
"Divide by 2" is not a field, so you can remove that one field that you tried to add and just divide "Remaining balance" by 2:
var RB1 = Number(this.getField("Remaining Balance 1").valueAsString);
if(RB1)
event.value = RB1/2;
else
event.value = 0;