Hi, I have two integer fields, "FIELD A" and "FIELD B". I am trying to add a constraint on "Field A" that meets the following conditions:
If "Field B" IS NULL, "Field A" can be any value (including NULL)
If "Field B" IS NOT NULL, "Field A" must be greater than "Field B"
Can anyone assist with the syntax please?
Regards, Damian
Solved! Go to Solution.
You just want it to eval to true so just give it a 1.
if(string-length(${Field_B}) > 0,${Field_A} > ${Field_B},1)
In 123 Null is empty string. So compare to '' or "".
Adding on to Doug's comment, use the function string-length(${q}) > 0 to test for null - all question types evaluate to a string length of 0 when null.
Thank you gents, however the answer still alludes me. The closest I can come up with is the following:
if(string-length(${Field_B}) > 0,${Field_A} > ${Field_B},*** any number or NULL ***)
Any further assistance would be greatly appreciated.
You just want it to eval to true so just give it a 1.
if(string-length(${Field_B}) > 0,${Field_A} > ${Field_B},1)
Ahh, many thanks Doug.