Check row existence in database using expression rule

Hi,

I am using an expression rule with parameters/filters to fetch data. When we have unmatched filters it is breaking the interface. I am using the below 2 expression rule to fill my drop downs which are cascading in nature. Choice values are concatenated with new items in both the drop downs.

When I select "New Program" in drop down 1, I get the below error as my expression rule returns null.

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'union' parameter 2 [line 88]: Invalid index: Cannot index property 'subProgram' of type Text into type List of Variant

Drop down 1:

choiceLabels: {union((union((rule!retrieveProgram("ABC").data.program),(rule!retrieveProgram("ABC","XYZ").data.program))),cast(type!List,"New Program"))}, 
choiceValues: {union((union((rule!retrieveProgram("ABC").data.program),(rule!retrieveProgram("ABC","XYZ").data.program))),cast(type!List,"New Program"))}, 

Drop down 2:

choiceLabels: {union((union((rule!retrieveSubProgram("ABC","value from dd1").data.subProgram),(rule!retrieveSubProgram("ABC","value from dd1").data.subProgram))),cast(type!List,"New Sub Program"))},
choiceValues: {union((union((rule!retrieveSubProgram("ABC","value from dd1").data.subProgram),(rule!retrieveSubProgram("ABC","value from dd1").data.subProgram))),cast(type!List,"New Sub Program"))}, 

Is there way to check row existence in expression rule, so that I can pass a dummy value when the row count is 0? tried totalCount & count functions but no success yet.

I am a beginner in APPIAN, request you to share detail response.

Thanks very much!

Reg/Mp

  Discussion posts and replies are publicly visible