Copy link to clipboard
Copied
I am trying to take an input value and round it up to the nearest whole 5 and then use that new value in an IF formula. However there is some detail I am getting incorrect as when the rounded value is outside of the parameters it returns the result anyway. Please where did I go wrong.
var SST = Number(this.getField("SST").value);
var SLT = Number(this.getField("SLT").value);
var SCT = Number(this.getField("SCT").value);
var Ref = this.getField("Ref").valueAsString;
var RSST = Number(Math.round((SST/5)*5).value);
if(Ref != "R410A") event.value = "";
else if (RSST = 50 && SCT == 120 && SLT == 50 ) event.value = 150-SCT;
else event.value = "";
Thank you.
You have few errors, in your script.
Change: RSST = 50 to: RSST == 50
Change variable RSST to this:
var RSST = Math.round(SST/5)*5;
Copy link to clipboard
Copied
You have few errors, in your script.
Change: RSST = 50 to: RSST == 50
Change variable RSST to this:
var RSST = Math.round(SST/5)*5;
Copy link to clipboard
Copied
Nesa,
I tried every iteration I could think of to get this to work and I swear I had to have tried that. You must be one of the people that nothing works until you show up and just by being there everything works.
Thank you again.
Copy link to clipboard
Copied
You have an error in your code.
Change:
if (RSST = 50
To:
if (RSST == 50