Fastest way to count number of order lines?

1
Order is associated with Orderlines. Suppose I want to display the number of orderlines behind each order in the grid, is there a faster way then having a microflow attribute in the order that does the counting with an ''aggregate list' action? [Especially since the microflow has to retrieve the entire list first, this will be sloooooow] If not would writing a Java variation on https://community.mendix.com/questions/667/Retrieving-the-instance-count-of-a-given-Mendix-Object help?
asked
1 answers
2

If you're retrieving a list of objects in a microflow and then only use it to perform a list aggregation operation on it, Mendix will automatically optimize this and perform that aggregation directly on the database.

In other words, if you would retrieve the order lines and count them in a microflow, Mendix will only perform a "SELECT COUNT(*) FROM ..." query on the database and never actually retrieve all the order line objects.

answered