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

I need help with a custom Calculation script

New Here ,
Jun 19, 2024 Jun 19, 2024

Copy link to clipboard

Copied

I'm making an order form for levels in a supply room. I have a set inventory level say 10. I have a text box to input the level currently on hand. I need to perform a calculation of the difference of the two numbers. That part is easy. I think. So if the level currently on hand is blank then I want the amount to order to be blank or if the amount on hand is equal to our over the amount allowed then it will also be blank. If that makes since. So I was trying to use:

 

var A = this.getField("Text2");

var B = 10

var D = ((var B - var A))

 

But I got a syntex error that I can't figure out and then there is the if statements for the blank text fields. If someone could help I would appreciate it. 

 

Thanks

TOPICS
Create PDFs , PDF , PDF forms

Views

155

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 ,
Jun 19, 2024 Jun 19, 2024

Copy link to clipboard

Copied

You can try this:

var A = Number(this.getField("Text2").valueAsString);
var B = 10;

if(A == 0 || A == B)
event.value = "";
else
event.value = B-A;

 

What should happen if someone enters more then (B) 10, it should show negative number?

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
New Here ,
Jun 19, 2024 Jun 19, 2024

Copy link to clipboard

Copied

I would like it to be blank 

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 ,
Jun 19, 2024 Jun 19, 2024

Copy link to clipboard

Copied

In that case, just change: A == B to: A >= B

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
New Here ,
Jun 20, 2024 Jun 20, 2024

Copy link to clipboard

Copied

LATEST

I am still unable to get this formula to work. Is there any way I could emal you the test PDF I am using to see if you could get it to work? if you have Adobe Acrobat Pro that is?

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