Skip to main content
Known Participant
Nov 9, 2021 11:05 AM UTC
Question

Errors in expression rule when multiple matches from the database.

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
    Inspiring
    Nov 9, 2021 12:12 PM UTC

    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?

    Known Participant
    Nov 9, 2021 1:41 PM UTC

    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
    Inspiring
    Nov 9, 2021 1:45 PM UTC

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