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

Javascript

Community Beginner ,
Apr 26, 2021 Apr 26, 2021

Copy link to clipboard

Copied

Field name: box1, box2, box3

Box3= smaller number  box1 or box2 multilply by 0.3489.

How to  write the script for box3 please?

TOPICS
JavaScript

Views

281

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 26, 2021 Apr 26, 2021

Copy link to clipboard

Copied

Please be more specific, what do you mean by smaller number? And what do you mean by "box"; a textfield object? a dropdown menu object? a listbox? 

 

Did you mean to ask that you're looking for someone to write a script for you and with that code be able to evaluate which texfield has a value greater than the other field's value?

 

And whichever value is not greater than the other then multiply by 0.3489 and display that tesult in a third textfield?

 

Where do you need this event to execute from? Do you want to run the code as a custom calculation script in the third texfeld where the total value will be displayed?

 

Are you goin to run the code as a mouse-up event from clicking on a button? 

 

Are there other fields' events interacting with the total that will be displayed in that third field object?

 

Please clarify.

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 Beginner ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

Multiply the smaller of box1 or box2 by 0.3489

Try67  got it thanks!!!

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

Copy link to clipboard

Copied

Use this code as the custom calculation script of "box3":

 

var v1 = Number(this.getField("box1").valueAsString);
var v2 = Number(this.getField("box2").valueAsString);
event.value = Math.min(v1,v2) * 0.3489;

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 Beginner ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

LATEST

It works thanks!!!

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