Choose which columns aggregates returns

By Marcelo Ferreira on 5 Jul

Would be nice to be able to choose which columns an agreggate returns instead of "Select *"

Hi Marcelo.

You might be surprised to know that this is done automatically. OutSystems analyzes your code to see which are the columns from your aggregate that you will need, and optimizes the SELECT statement for those columns only.

You might be even more surprised to know that it also optimizes the number of rows to fetch. So, if you are only interested in knowing if the aggregate list is empty or not, OutSystems is able to optimize your SELECT to return just the first row. Or, if you are displaying the first 10 results in a table, the SELECT is optimized to return the first 10 rows and not more.

So if i have and aggregate with multiple entities but I only want the list of one of them can I assign it directly to one variable of that type?

EX: aggregate with "a" inner join "b". i want to assign to the var "x" of type "a" aggregate.list. is this possible?

I already knew outsystem about the Outsystems optimizations. But i really would like to know if its possible to achieve what I want. If its possible i will just delete the ideia. If not i will update the ideia to explain me better.

Thx for your feedback.

Hi Marcelo,

You can indeed have an Aggregate that joins A with B and then have an Assign that only saves the List of As. The screenshot below shows this. The Type of the variable is A List. Let me know if you need any further help! 



Regards,

Henrique Henriques

Sorry, the image was smaller than expected. Here's a larger version so you can see what's in the Assign.


I work mostly on version 9. But good to know that its workins like that on 10.