Copy link to clipboard
Copied
Good Morning. I am trying to figure out how to get a field to automatically populate a value using java script with an if then statement. I want it to look at the value of two other fields and return which is the highest, below is the code i have been using. Any and all help is appreciated. I have tried it on both the calculations tab with custom java script and on the Actions tab but am unsure which trigger to use and which is correct.
if(this.getField("EXV").value > this.getField("CFMV").value){
event.value = EXV
} else {
Event.value = CFMV
}
[Moderator moved the thread to the correct forum]
Copy link to clipboard
Copied
Try this:
var EXV = Number(this.getField("EXV").valueAsString);
var CFMV = Number(this.getField("CFMV").valueAsString);
if(EXV > CFMV) {
event.value = EXV;
} else {
event.value = CFMV;
}
Copy link to clipboard
Copied
JavaScript is case sensative. You cannot have the value of an event wrtitten as "Event.value" and "event.value".