Shouldn’t the conditional below require both conditions be met
IF([Class]=”Std” & [YPS]>3.64;””;”?”)
thanks Tim
I’m not sure the equals operator works properly with strings and always returns a true.
Try IFEQUAL
, e.g. IFEQUAL([Class], "Std", 1, 0)
instead of [Class]="Std"
.
Actually, this doesn’t address the question because two conditions have to be met in order to be true. You only addressed one condition
Just to double check, this didn’t work?
IF(IFEQUAL([Class], "Std", 1, 0) & [YPS]>3.64;"";"?")
In the minor testing I did with a calculation field (by the way don’t forget to set it to text on the bottom left of the editor from the default of number), this seemed to work:
IF(IFEQUAL("TEST", "TESTX", 1, 0) & 2 > 1; "", "?")
If I change either of the two conditions (e.g. make the IFEQUAL fail or the greater than), then the flag shows up.
Thanks works, I just needed to change the results order
What this same calculated field look like in a script Thanks much
As a script it’d be something like this:
function Flag() {
var classtype = record.getFieldValue("fld-fieldid1");
var yps = record.getFieldValue("fld-fieldid2");
return (classtype == "Std" && yps > 3.64) ? "" : "?";
}
return Flag();
Note: class
is a reserved word in Javascript so not a valid variable name.
The fld-fieldid1
is the ID of the field, the script editor can help you generate a line for that (double click field on desktop or on mobile there is a field picker) with the variable name and field ID preset. You can also get the field ID from the form editor when you select the field to splice in the ID yourself.
You don’t need the full function wrapper but I find it feels more natural to do the return statement. The return is using a ternary operator to do the comparison compactly.