Skip to main content
Participating Frequently
July 3, 2020
Question

NEED HELP WITH JAVASCRIPT IF STATEMENTS

  • July 3, 2020
  • 2 replies
  • 445 views

I need to calculate the following in FieldC calculation.

IF FIELDA is greater than FIELDB then FIELDB value goes into FIELDC.

 

Can anyone help me do this??

 

you're help would be greatly appreciated.

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
July 3, 2020

What about if it's not, though?

BarlaeDC
Community Expert
Community Expert
July 3, 2020

Hi,

 

You would need to use something like :

 

var FIELDA = this.getField ("FIELDA").value;

var FIELDB = this.getField("FIELDB").value;

if ( FIELDA > FIELDB) {

    this.getField("FIELDC").value = FIELDB;

}

 

This is just a quick example.

 

Regards

 

Malcolm

Participating Frequently
July 12, 2020

Thank you for helping me out but I guess I didn't add that if FieldA is less than or equal to FieldB then the value in FieldC should be the value of FieldA.

 

Could you help me with that.

 

And, would you know how to validate a field so that if the amount input is greater than another specified field it would show an error and not allow the input.