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

Need help in establishing a minimum value on Adobe field

New Here ,
Feb 08, 2021 Feb 08, 2021

Copy link to clipboard

Copied

I am computing a value of a system we are auditing. The field is CashValue. It is calulating correctly except that I want to set a minimum value of 1000. What do I need to change? Here is the code that Adobe generated. 

 

//<AcroForm>
//<ACRO_source>CashValue:Calculate</ACRO_source>
//<ACRO_script>
/*********** belongs to: AcroForm:CashValue:Calculate ***********/
/** BVCALC (1-Discount)*Average EVCALC **/event.value=(1-AFMakeNumber(getField("Discount").value))*AFMakeNumber(getField("Average").value)
//</ACRO_script>
//</AcroForm>

TOPICS
Create PDFs , How to , JavaScript , PDF forms

Views

344

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 ,
Feb 09, 2021 Feb 09, 2021

Copy link to clipboard

Copied

Let me see if I have this correct: You want to calculate the field by multiplying Discount and Average, and if the result is less than 1000, use 1000 as the calculated value. Is that correct? If so, you need to switch to a JavaScript calculation script. The simple field calculation will not be able to do that. Try the following script:

 

var val = Number(this.getField("Discount").value) * Number(this.getField("Average").value);

if (val < 1000) {
    event.value = 1000;
}
else {
    event.value = val;
}

 

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 ,
Feb 12, 2021 Feb 12, 2021

Copy link to clipboard

Copied

LATEST

Thanks for the help. 

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