Query Entity fails when using operator "in" against a very large array. It succeeds if I leave out the operator and return every result.

Certified Senior Developer

I'm using a query against a table that contains a column with Appian usernames, and I am passing it a very large list of usernames to search for (3,900) using the "in" operator. When I call this query entity, I am getting the following error:

 

Expression evaluation error at function a!queryEntity: An error occurred while retrieving the data.

 
 
An example query entity that demonstrates the issue:
 

a!queryEntity(
  entity: cons!ENTITY_T_USER,
  query: a!query(
    filter: a!queryFilter(
      field: "UserName",
      operator: "in",
      value: touniformstring(enumerate(3000))
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: - 1
    )
  )
).data


If you play with the size of the enumerate, it will work when it's lower (i.e. 2,000 still works for me), but fail when it gets higher. Setting a batchSize doesn't help (since that would effect the number of results returned, but this is failing because a filter is too long).

I've been able to work-around this issue by instead removing the filter, and using looping functions to filter the results after I return everything. This doesn't seem ideal, since it's now a multi-step process (get everything from db, then filter it - rather than using the query to filter).

  Discussion posts and replies are publicly visible

Parents Reply
  • You could definitely use the batching approach. This number of usernames wouldn't create too much performance overhead. To improve your QE performance, you could add a selection parameter, so you don't retrieve all fields of the relevant table, only the one(s) you need to make this determination.

    Another option you could explore is using the Query Database smart service. This performs significantly better, but adds maintenance and data manipulation considerations.
Children
No Data