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

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

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Why does you multiply with 10?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

173

Likes

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

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

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

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Why does you multiply with 10?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

174

Likes

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
Apr 26, 2019 0
Adobe Community Professional ,
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

Likes

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
Reply
Loading...
Apr 27, 2019 0
Adobe Community Professional ,
Apr 27, 2019

Copy link to clipboard

Copied

Why does you multiply with 10?

Likes

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
Reply
Loading...
Apr 27, 2019 0
New Here ,
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.

Likes

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
Reply
Loading...
Apr 27, 2019 0
Most Valuable Participant ,
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;

}

Likes

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
Reply
Loading...
Apr 27, 2019 0
Adobe Community Professional ,
Apr 27, 2019

Copy link to clipboard

Copied

Why do you multiply with 10?

Likes

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
Reply
Loading...
Apr 27, 2019 0
Most Valuable Participant ,
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.

Likes

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
Reply
Loading...
Apr 27, 2019 0
Most Valuable Participant ,
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;

}

Likes

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
Reply
Loading...
Apr 27, 2019 0
New Here ,
Apr 27, 2019

Copy link to clipboard

Copied

Hi Thanks, But still it is not solving the problem

Likes

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
Reply
Loading...
Apr 27, 2019 0
Most Valuable Participant ,
Apr 27, 2019

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Apr 27, 2019 0
New Here ,
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

Likes

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
Reply
Loading...
Apr 28, 2019 0
Most Valuable Participant ,
Apr 29, 2019

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Apr 29, 2019 0
New Here ,
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

Likes

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
Reply
Loading...
Apr 29, 2019 0
Most Valuable Participant ,
Apr 29, 2019

Copy link to clipboard

Copied

[try6767 at gmail.com]

Likes

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
Reply
Loading...
Apr 29, 2019 0
New Here ,
Apr 29, 2019

Copy link to clipboard

Copied

Hi Sent

Likes

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
Reply
Loading...
Apr 29, 2019 0
New Here ,
Apr 29, 2019

Copy link to clipboard

Copied

Thanks it is solved

Likes

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
Reply
Loading...
Apr 29, 2019 0
New Here ,
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.

Likes

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
Reply
Loading...
Apr 27, 2019 0