Good morning,
I am loading a picker through the records of a DB table, But the error "Expression evaluation error at function a! queryEntity: An error occurred while retrieving the data."I think the reason may be due to the volume of data it recovers, it can exceed 10,000.Is there a maximum number to obtain data?
Thx
Discussion posts and replies are publicly visible
Query Limits can be found here:
https://docs.appian.com/suite/help/20.2/Post-Install_Configurations.html#query-limits
Note: the message you're receiving can also be generated when you're retrieving data that isn't consumable by Appian e.g. a datetime value that has '0000-00-00 00:00' in the database.
Thank you for your answer.At first the information in the data is correct, however we will review it.
For UX and system performance typically you will want to reduce your picker's returned values to say 10-15 via pagingInfo in the queryEntity. As the user types in the picker field, the search function reduces results based on their input and the top 10-15 are shown. If the picker field is attempting to return thousands of results, the user would have to scroll for pages and pages to locate what they need. And as Stewart notes, queryEntity is limited to the amount of data it can return.
Thanks for the reply Chris.
But my problem is that they want to select by means of a picker the possible values of the customer table, which can reach 12000 lines.
This is the code I have in the rule that loads the picker:
a!queryEntity( entity: cons!NAME_TABLE, query: a!query( logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "EstadoClient", operator: "=", value: "A" ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 11400, sort:a!sortInfo( field:"IdClient", ascending: true ) ) ), fetchTotalCount: false).data
But the table has more than 12000 lines.
You'll need to find a way to present the list in smaller chunks. You have options:
thanks for your answer Stewart.We do not have a hierarchy, they are clients and therefore individual records.At first we had a dropdown but it was not very optimal as you say since it was an infinite list, so it was switched to a picker so that the user could enter some characters and recommend it, but it seems that this option does not work eith
"Does not work either" - are you still encountering the same error? ("Expression evaluation error at function a! queryEntity: An error occurred while retrieving the data.")
Looking at your code, if you want to filter by, say, the Client's name, then your filter needs to be something like:
filters: { a!queryFilter( field: "EstadoClient", operator: "starts with", value: ri!startsWith
If you call this rule ONLY when the User has added, say, 3 or more characters then the returned list will be much smaller (and you can safely set the 'batchSize' to -1 when you know that the list will not break the query limits)
...and now I've started to have other thoughts which may take your design in a totally different direction....in what context are you wanting to pick from this list? What is the User going to do (or is doing) at the point a Client is picked?
I think I have two problems:1 - the rule to load the picker does not return the whole table to me. The table has 12000 lines and returns only 11400, but I start to think that it is a data problem, I don't know ... the error is the following "Expression evaluation error in function a! QueryEntity: an error occurred while retrieving the data ".2 - Even forcing it to return less amount of data so that it does not fail, when I look for the selector it does not offer me certain information that I know exists in the database and that the rule returns.
But I come to the conclusion that I am not creating the picker in an optimal way:
local!arrayClient: rule!STD_GetListCliente(), a!pickerFieldCustom( label: "Client", labelPosition: "ABOVE", maxSelections: 1, suggestFunction: rule!STD_ucArrayPickerFilter( filter: _, labels: a!forEach(local!availableClients, concat(fv!item.IdClienteSTD, " - ", fv!item.NameClient)), identifiers: local!availableClients.IdClient ), selectedLabels: a!forEach( items: local!clientId, expression:concat( local!availableClients.IdClienteSTD[ wherecontains( tointeger( fv!item ), tointeger( local!availableClients.IdClient ) )], " - ", local!availableClients.NameClient[ wherecontains( tointeger( fv!item ), tointeger( local!availableClients.IdClient ) )] ) ), value: local!clientId, saveInto: { local!clientId, a!save( target: ri!securityTransfer.portfolio.IdClient, value: rule!SAN_CLS_GetClientByRealID( local!clientId ) ), a!save( target: local!selectedPortfolio, value: null ) }, validations: {} )
In the end I was able to find a pattern to get fewer records.Thanks for your time