Using a queryEntity expression, would it be possible to set a queryFilter that c

Using a queryEntity expression, would it be possible to set a queryFilter that compares two entity fields for a condition? For example, if I want to query set of tasks from tasks table that are overdue, can I specify queryFilter in such a way that checks if 'taskCompletionTime' > 'taskDeadLineTime' and these are fields in my cdt/entity. This type of filtering is possible in SQL and I think it’s a nice one to have in Appian too that saves us from creating a database view for such simple usecases. Did anyone encounter similar ideas and/or what are the best possible ways to do it besides creating a view?

OriginalPostID-223882

OriginalPostID-223882

  Discussion posts and replies are publicly visible

  • The a!queryFilter allows only one field to be specified. So, you cannot filter by comparing two fields.
    Since you are looking for a solution which does not use a DB View, I suggest the following:
    When using the a!queryEntity function, do not try to filter based on 'taskCompletionTime' > 'taskDeadLineTime' . Instead get all the data(you can ofcourse use the other queryFilters if you are applying them) .
    Then, create another rule which takes only one CDT object. Check for the condition in it 'taskCompletionTime' > 'taskDeadLineTime' . You can say: myCDT.taskCompletionTime > myCDT.taskDeadlineTime. Then. you can use the filter() function to filter out the CDTs which satisfy the rule we just created.

    That way you will be able to filter out the necessary items.
    This is a little cumbersome - but it is fine if you want to avoid creating a DB view - however, it will cause slight overhead on Appian UI.
  • I would say that comparing the two fields is already available in database and it may not be worth trying to implement the same in Appian(pulling back all the database data into Appian and operating on it using Looping Functions) which would impose a additional overhead on the SAIL interface and this also makes the maintenance or changes complex in case if similar requirements arise in the future.
  • @Sikhi, agree that it is not a good idea to replicate the functionality of database for filtering using the looping functions. But, since the question asked for avoiding DB view, I think the only way to do it in Appian is to use the looping functions like filter.