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
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
Your query is getting timed-out. You will require to optimize your query. Make sure you are querying only those columns that you need. As you have mentioned that you have 19L + records, you may need to do some workaround. Like do not query until user has provided 3 digits.
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", {}) ) ))
Thanks Raviroshan,
We are querying len(ri!id) is 4 or more then only we are querying the data otherwise not. Also shared the sample code in above reply. Please refer if any optimization we can do in code please suggest.
if(len(ri!id) < 4,null,a!queryEntity()