• 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 to reference a calculation field to bring back a value in another field

New Here ,
Feb 11, 2019 Feb 11, 2019

Copy link to clipboard

Copied

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

Views

370

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

Votes

Translate

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

Copy link to clipboard

Copied

Try this:

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

if (LevelRate == .0550)

    event.value = .0574;

else if (LevelRate == .0525)

    event.value = .0549;

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

LATEST

Bernd,

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

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