• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to display blank on computed field instead of zero?

Contributor ,
Feb 27, 2023 Feb 27, 2023

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.

 

 

 

TOPICS
How to , PDF forms

Views

3.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 28, 2023 Feb 28, 2023

As validation script of that field, use this:

if(event.value == 0)event.value = "";

Votes

Translate

Translate
Community Expert ,
Feb 28, 2023 Feb 28, 2023

Copy link to clipboard

Copied

As validation script of that field, use this:

if(event.value == 0)event.value = "";

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

Hi Nesa,

 

Thank you for always being there to help me with my issue. Very much appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

This did not work for me. It actually produced a 0 once the calculation was run?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

I need it to be blank unless a calculation is run in the associated fields.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 08, 2023 Mar 08, 2023

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 09, 2023 Mar 09, 2023

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);

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2023 Mar 09, 2023

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 = "";

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

That did not work either 😞 Sigh...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2023 Mar 09, 2023

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 20, 2023 Mar 20, 2023

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 = "";

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 20, 2023 Mar 20, 2023

Copy link to clipboard

Copied

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 20, 2023 Mar 20, 2023

Copy link to clipboard

Copied

LATEST

"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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines