Unexpected error executing query

Hi,

We are using Picker field to search client name based on id, using an expression rule to get result of data subset when user enter id or client name. Minimum four char should provided by user in picker field search so that query will search the matching data and displays first 10 ids. For some ids while searching in picker field, getting an below error:

An error occurred while retrieving the data. Details: Unexpected error executing query (type:LKTableDataDT2865], query: [queryentity expression], order by: [[Sort[id asc]]], filters: [((id = TypedValue[it=3,v=9000152]) OR (clientname includes TypedValue[it=3,v=9000152]))])

Here, in LKTableData we have records around 19lakhs plus.

Regards,
Sandeep

  Discussion posts and replies are publicly visible

Parents
  • It seems your input type passed is not as expected with client name data type in DB or even with 4 characters you have huge amount of data pulled out.

    Try out by just making it something so that it return only record in DB.

    Also share your code

  • Thanks Dhananjay / Raviroshan,

    Please refer to the below sample code for your reference:

    a!localVariables(
    local!data: if(
    len(ri!id) < 4,
    null,
    a!queryEntity(
    entity: cons!LKTableData,
    query: a!query(
    paginginfo: a!pagingInfo(1, 10),
    selection: a!querySelection(
    columns: {
    a!queryColumn(field: "id"),
    a!queryColumn(field: "clientName")
    }
    ),
    logicalExpression: a!queryLogicalExpression(
    operator: "OR",
    filters: {
    a!queryFilter(field: "id", operator: "=", value: ri!id),
    a!queryFilter(
    field: "clientName",
    operator: "includes",
    value: ri!id
    )
    }
    )
    )
    ).data
    ),
    if(
    len(ri!id) < 4,
    a!dataSubset(data: {}, identifiers: {}),
    a!dataSubset(
    data: index(local!data, "clientName", {}),
    identifiers: index(local!data, "id", {})
    )
    )
    )

Reply
  • Thanks Dhananjay / Raviroshan,

    Please refer to the below sample code for your reference:

    a!localVariables(
    local!data: if(
    len(ri!id) < 4,
    null,
    a!queryEntity(
    entity: cons!LKTableData,
    query: a!query(
    paginginfo: a!pagingInfo(1, 10),
    selection: a!querySelection(
    columns: {
    a!queryColumn(field: "id"),
    a!queryColumn(field: "clientName")
    }
    ),
    logicalExpression: a!queryLogicalExpression(
    operator: "OR",
    filters: {
    a!queryFilter(field: "id", operator: "=", value: ri!id),
    a!queryFilter(
    field: "clientName",
    operator: "includes",
    value: ri!id
    )
    }
    )
    )
    ).data
    ),
    if(
    len(ri!id) < 4,
    a!dataSubset(data: {}, identifiers: {}),
    a!dataSubset(
    data: index(local!data, "clientName", {}),
    identifiers: index(local!data, "id", {})
    )
    )
    )

Children
No Data