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

I need to reference a calculation field to bring back a value in another field

New Here ,
Feb 11, 2019 Feb 11, 2019

This field is calculating correctly based on the value in equipment

the field name is LevelRate

var nEquipment = this.getField("equipment").value;

if (nEquipment<=49999)
    event.value = .0550;
else if  (nEquipment>=50000)
    event.value = .0525;

I want to reference LevelRate in another field

if LevelRate is .0550 the new field VariableRate need to be .0574

I'm trying this but it's not working I tried calculation order and putting it in validate vs. calculate

this.getField("LevelRate").value

if (LevelRate=.0550)
    event.value = .0574;

else if (LevelRate=.0525)
    event.value = .0549;

TOPICS
Acrobat SDK and JavaScript , Windows
570
Translate
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 11, 2019 Feb 11, 2019

Try this:

LevelRate = Number(this.getField("LevelRate").valueAsString);

if (LevelRate == .0550)

    event.value = .0574;

else if (LevelRate == .0525)

    event.value = .0549;

Translate
Community Expert ,
Feb 11, 2019 Feb 11, 2019

Try this:

LevelRate = Number(this.getField("LevelRate").valueAsString);

if (LevelRate == .0550)

    event.value = .0574;

else if (LevelRate == .0525)

    event.value = .0549;

Translate
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 11, 2019 Feb 11, 2019

I would also add this line at the end, just in case the result is neither one of those values:

else event.value = "";

Translate
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 11, 2019 Feb 11, 2019
LATEST

Bernd,

This is brilliant, thank you so much. I'm a non-coder and just trying to hack it

Translate
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