Define and use QUERIES (simple and advanced) like we define and use USER ACTIONS

By Tiago Bernardo on 23 Oct 2013
We define a user action to implement some logic. In the same way we could define queries to implement some logic, for example "GetArticlesNotPublished". Then we could reuse those queries in web flows like we use user actions.
In the right side toolbox, in the Logic section, we would have in the tree a node "Queries".
This is somehow similar to the element "refresh query", that we can use to refresh a query in a screen action, but in a more overall approach.

Yes, we could define a user action which wraps a query and returns a record list, but in this way I think we lose the optimizations made by the platform.
Kilian Hekhuis25 Oct 2013
+1 Often, in multiple preparations of similar web screens we have similar queries that could benefit from this idea being implemented.

As for those who wonder what optimizations the platform makes, I can think of at least two:
1) Only the attributes actually used within the query's scope are retrieved in the SELECT, which can be advantageous when SELECTing a number of large tables
2) When using the query results in a For each-loop, the platform opens a cursor to retrieve the results one-by-one instead of first downloading the entire set, which enhances performance.