Skip to main content
November 9, 2021
Question

Errors in expression rule when multiple matches from the database.

  • November 9, 2021
  • 14 replies
  • 0 views

Hi All,

I am getting the error if multiple matches exist for the filter criteria. Below given is the code. Can anyone please help me out?

a!queryEntity(
entity: cons!TEMS_ENTITY_V_TE_DETAILS,
query: a!query(
paginginfo: a!pagingInfo(1, - 1),
logicalexpression: a!queryLogicalExpression(
operator: "OR",
filters: {
a!queryFilter(
field: "cafNumber",
operator: "=",
value: tostring(local!selectedCaf)
)
}
)
),
fetchTotalCount: true
).data

    14 replies

    richardm900458
    November 9, 2021

    Hi shubhamy,

    1.) please try this function for inserting code.

    This makes the life of your content reader way easier.

    2.) What is the error telling you, can you insert as well?
    what is the overall use case? Often its not an issue of your query and more of the usage of the query.

    3.) 

    a!queryLogicalExpression(
    operator: "OR",
    filters: {
    a!queryFilter(
    field: "cafNumber",
    operator: "=",
    value: tostring(local!selectedCaf)
    )
    }
    )

    a) why are you using "OR"?

    b) why are you using querylogialexpression and not just the "filter" parameter of your query if you are looking for just one value in your DB?

    c.) is "local!selectedCaf" multiple?

    November 9, 2021

    Hi Richard,

    I am getting the following error:

    Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!textField [line 1606]: Invalid index: Cannot index property 'permittedTeRange' of type String into type List of Variant.

    Yes, local!selectedCaf can be multiple in dropdown but user will select only one.

    pavang5769
    November 9, 2021

    Hi, can try type casting the data type to the required CDT type.