Skip to main content
Known Participant
August 27, 2021
Question

Greater than & If statement

  • August 27, 2021
  • 1 reply
  • 1815 views

Hi All,

 

I have the following as a custom calculation script in a field called TRANSIT STATIC UKC. Basically i want is, if the field named TRANSIT MAXIMUM DRAFT has a value greater than 10 to return a custom text, if its less than 10 then then a calculation is completed as per below. When I had just the calculation script running all was good, but when I added in the extra bit it all stopped working. 

 

 

if(this.getField("TRANSIT MAXIMUM DRAFT").(event.value > 10)){ app.alert("SEE DUKC CALC"); }else event.value = (Number(this.getField("TRANSIT ACTUAL DEPTH").valueAsString) - Number(this.getField("TRANSIT MAXIMUM DRAFT").valueAsString));

 

Thanks

LC

This topic has been closed for replies.

1 reply

ls_rbls
Community Expert
Community Expert
August 27, 2021

There are typos and errors in the syntax.

 

Try your code like this:

 

 

if(this.getField("TRANSIT MAXIMUM DRAFT").value > 10){ 
app.alert("SEE DUKC CALC"); 

} else {

event.value = (Number(this.getField("TRANSIT ACTUAL DEPTH").valueAsString) - Number(this.getField("TRANSIT MAXIMUM DRAFT").valueAsString));

}

 

Known Participant
August 27, 2021

Thanks for that. 

 

All good. 

 

Cheers

LC

ls_rbls
Community Expert
Community Expert
August 28, 2021

You're welcome.