What is the best way to null check a date rule input before using inside Expression Rule? In order to prevent the below error:
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!queryFilter [line 24]: The a!queryFilter function has an invalid value for the “value” parameter. When the value of “operator” is “<=” “value” must not be null or empty.
Discussion posts and replies are publicly visible
Hi, Please replace the a!queryFilter code with below code. if( isnull( ri!dateField ), null, a!queryFilter( field: "dateField", operator: "<=", value: ri!dateField ) ) Thanks Aditya
This is close but I believe it won't work as written. The issue I expect is because the queryFilter() element is usually within an expected array of queryFilters, and passing null() will break it.
This (slight) modification would not have this issue:
if( isnull(ri!dateField), {}, a!queryFilter( field: "dateField", operator: "<=", value: ri!dateField ) )
I agree with using the common objects functions for those that have them. I use the apn_isBlank() and apn_isEmpty() functions almost exclusively.
apn_isBlank()
apn_isEmpty()
I'd just note here that you were probably thinking of apn_isBlank(), which is intended to check the null / blank status of a single entity. apn_isEmpty(), on the other hand, is intended to take an array and check that it's empty (and it handles being passed a null value too, unlike the primitive functions).