Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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));
}
Copy link to clipboard
Copied
Thanks for that.
All good.
Cheers
LC
Copy link to clipboard
Copied
You're welcome.
Copy link to clipboard
Copied
If calculation takes place and after that you change 'draft' value to be higher then 10 do you still want value from calculation to be visible or field to be empty in that case?