Hi Team,
Need your help to resolve the problem -
Problem - Getting this error while executing the query entity code - Expression evaluation error at function a!queryEntity [line 3]: Cannot apply operator [IN] to field [id] when comparing to value [TypedValue[it=3,v=1; 2]].
Query Entity code -
a!localVariables( local!panelId:"1; 2",a!queryEntity( entity:cons!IM_INTERVIEW_PANEL_DSE_POINTER, query: a!query( selection: a!querySelection( columns: { a!queryColumn( field: "name" ) } ), filter: a!queryFilter( field:"id", operator:"in", value: local!panelId ), paginginfo: a!pagingInfo( startIndex: 1, batchSize: -1 ) ) ).data.name)
Discussion posts and replies are publicly visible
You try to compare the field id to a string. To make that work, change line 2 to list of numbers like
local!panelId: {1,2}
Hi, your local!panelId variable is currently defined as text, it appears you would like to define it as a list of integer such as {1,2}. Try this code instead:
a!localVariables( local!pandelId: {1,2}, a!queryEntity( entity:cons!IM_INTERVIEW_PANEL_DSE_POINTER, query: a!query( selection: a!querySelection( columns: { a!queryColumn( field: "name" ) } ), filter: a!queryFilter( field:"id", operator:"in", value: local!panelId ), paginginfo: a!pagingInfo( startIndex: 1, batchSize: -1 ) ) ).data.name )
Also, when posting code in the forum here, please take advantage of the "Insert -> Code" feature for readability. Otherwise, please let us know if the above resolves your issue.
Beat me by a nanosecond :)
Actually I got the value - "1; 2" from CDT field. For testing, I have used same value in local variable.
Is the CDT field a single value, or multiple, and which data type? Can you confirm that the "id" field is a single integer field?
CDT field is single value but it store value in this format - "1; 2".
"id" field is a single integer field
As you are storing multiple integer values in a single text field, you can use a combination of split() and tointeger() to format correctly for the query:
a!localVariables( local!pandelId: a!forEach( items: split( "1; 2", /* replace with a call to your CDT field */ ";" ), expression: tointeger(fv!item) ), a!queryEntity( entity:cons!IM_INTERVIEW_PANEL_DSE_POINTER, query: a!query( selection: a!querySelection( columns: { a!queryColumn( field: "name" ) } ), filter: a!queryFilter( field:"id", operator:"in", value: local!panelId ), paginginfo: a!pagingInfo( startIndex: 1, batchSize: -1 ) ) ).data.name )
Solution is working. Thank you so much.
Great!
I would like to know how the CDT looks like. I mean the one from which you get the "1; 2" string. Appian displays a list of numbers in expression designer just like this. Please give a bit more details. I want to make sure to not guide you into a wrong direction.