I’ve set up a date search in my Appian interface backed by a Cloud DB table. When users select a date, it updates a rule input, which is then used to filter records. The filtering works well and shows only the data for that selected date.
query: a!query( filter: if( isnull(ri!onInputChange), null, a!queryFilter( field: "createdOnDate", operator: "=", value: ri!onInputChange ) )
But, when I am adding the interface as a page to the Site, I am getting the error below:Error Evaluating UI Expression Expression evaluation error [evaluation ID = 296a3:3b232] in rule <table_Name> : Cannot apply operator [EQUALS] to field [createdOnDate] when comparing to value [TypedValue[it=49,v=<null>]].
Discussion posts and replies are publicly visible
When the interface is added as a page to the Site, the value being passed in the filter (ri!onInputChange) appears as null or an invalid typed value for the equals operator on the date field.Try below 2 approach to handle null.
a!queryFilter( field: "createdOnDate", operator: "=", value: ri!onInputChange, applyWhen: a!isNotNullOrEmpty(ri!onInputChange) )
filter: if( or( isNullOrEmpty(ri!onInputChange), ri!onInputChange = "" ), {}, /* Return empty filter array instead of null */ a!queryFilter( field: "createdOnDate", operator: "=", value: ri!onInputChange ) )