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

Javascript

Community Beginner ,
Apr 26, 2021 Apr 26, 2021

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

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.

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

Multiply the smaller of box1 or box2 by 0.3489

Try67  got it thanks!!!

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

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

It works thanks!!!

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