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 Children
  • 0
    Certified Senior Developer
    in reply to Vinay Kumar Rai
    My workaround is similar to this approach (I'm using filter() and a rule that checks on contains(), but the same idea).

    My main purpose of this thread is to bring to Appian's attention that the filter in a query entity has these limitations, and there are use cases to improve it. I shouldn't have to apply the filtering after querying on everything - it seems inefficient to pull back all results when I know I only want some of them, but somehow that has better performance than sending a large filter (which causes it to error out due to timing out).