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

Please help to convert this excel formula in java script if(text32>601,text32*1,text32*text10) Thanks in Anticipation

New Here ,
Apr 26, 2019 Apr 26, 2019

Copy link to clipboard

Copied

if(text32>601,text32*1,text32*text10)

Please help to convert above mentioned formula in java script

Thanks in anticipation

TOPICS
Acrobat SDK and JavaScript , Windows

Views

604

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 , Apr 27, 2019 Apr 27, 2019

Why does you multiply with 10?

Votes

Translate

Translate
Community Expert ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

Hi,

Assuming the fieldNames are text32 and text10

then the if would be

var text32Value =  this.getField("text32").value;

if ( text32Value <= 601) {

     var result = text32Value * 10;

} else {

     var result = text32Value;

}

As to what you want to do with result, you would need to explain more about your form? This would probably be best placed on the Validate of text32, as then it is only run if text32 changes.

Regards

Malcolm

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

Why does you multiply with 10?

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

JAVA.jpg

Text10 is the qty and Text 32 is value the logic is if text32 value goes beyond 602 $ it will remain 602 in the total result.

if Text32 is lower then 602 $ it will multiply with qty and give the result as given in image.

Kindly help to provide the script

Thanks in advance.

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

Use this code as the custom calculation script of the field where you want to display the results:

var text32Value =  Number(this.getField("text32").valueAsString);

if ( text32Value <= 601) {

    event.value = text32Value * 10;

} else {

    event.value = text32Value;

}

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

Why do you multiply with 10?

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

Sorry, I just adjusted the code provided before. I see now it should be a field... Will post an updated version shortly.

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

Fixed version:

var text32Value =  Number(this.getField("text32").valueAsString);

var text10Value =  Number(this.getField("text10").valueAsString);

if (text32Value <= 601) {

    event.value = text32Value * text10Value;

} else {

    event.value = text32Value;

}

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

Hi Thanks, But still it is not solving the problem

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

You need to provide more information about what goes wrong...

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 ,
Apr 28, 2019 Apr 28, 2019

Copy link to clipboard

Copied

post insertion of code in form it is not giving the result as it comes as 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 ,
Apr 29, 2019 Apr 29, 2019

Copy link to clipboard

Copied

Check the JS Console (Ctrl+J) for error messages.

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 ,
Apr 29, 2019 Apr 29, 2019

Copy link to clipboard

Copied

send me your mail ID i will mail you the file as i am completely noob in this

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 ,
Apr 29, 2019 Apr 29, 2019

Copy link to clipboard

Copied

[try6767 at gmail.com]

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 ,
Apr 29, 2019 Apr 29, 2019

Copy link to clipboard

Copied

Hi Sent

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 ,
Apr 29, 2019 Apr 29, 2019

Copy link to clipboard

Copied

LATEST

Thanks it is solved

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 ,
Apr 27, 2019 Apr 27, 2019

Copy link to clipboard

Copied

JAVA.jpg

Text10 is the qty and Text 32 is value the logic is if text32 value goes beyond 602 $ it will remain 602 in the total result.

if Text32 is lower then 602 $ it will multiply with qty and give the result as given in image.

Kindly help to provide the script

Thanks in advance.

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