IN operator not working

-------Updated below code--------------

Hi ,

local!data: a!queryEntity(
entity: cons!TEST ,
query: a!query( )
),

local!dataF:index(local!data.data,wherecontains((9555),year(local!data.data.date))),



local!dataH: a!queryEntity(
entity: cons!HELLO,
query: a!query(
logicalExpression: a!queryLogicalExpression(
operator: "AND",
filters: {
if(rule!APN_isBlank(local!dataF.name),
{},
a!queryFilter(
field: "name",
operator: "in",
value: local!dataF.name
)
)})))

By running above code i am getting below error.

Expression evaluation error at function a!queryEntity [line 80]: Cannot apply operator [IN] to field [componentId] when comparing to value [TypedValue[it=3,v=1027A]].

Why IN operator i not working inside query filter. Outside its printing correct value. What exactly its expecting ?

Can any help me on this ?

  Discussion posts and replies are publicly visible

Parents
  • Hello Saurav

    The type 3, if I am not wrong is the text. (Check it using this typename(3) )

    So I am guessing the id on which you have the “in” is an integer. So if you try to pass a text on a field which is an integer makes sense getting that error.

    Why this is happening? Well the joinarray resturna a text. The problem is around that.

    I was trying to follow your code and seems like you took out some pieces there.

    Hope this helps

    Jose

  • typo error. Please consider id as text here

    local!data: a!queryEntity(
    entity: cons!TEST ,
    query: a!query( )
    ),

    local!dataF:index(local!data.data,wherecontains((9555),year(local!data.data.date))),

    local!dataH: a!queryEntity(
    entity: cons!HELLO,
    query: a!query(
    logicalExpression: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    if(rule!APN_isBlank(local!dataF.componentId),
    {},
    a!queryFilter(
    field: "componentId",
    operator: "in",
    value:local!dataF.componentId
    )
    )})))

    Its comparing text to text only.

  • 0
    Certified Senior Developer
    in reply to sauravk

    Jose is correct, 

    seems Id is integer not TEXT,

    Try this

    a!queryFilter(
    field: "componentId",
    operator: "in",
    value:tointeger(local!dataF.componentId)
    )

Reply Children