Hi,

I'm having Accounts entity and Transactions entity. 

Here one Account can have multiple transactions.

My Question is,

How can i get The last transaction of each account by using aggregates in Outsystems.?

Aravind M wrote:

Hi,

I'm having Accounts entity and Transactions entity. 

Here one Account can have multiple transactions.

My Question is,

How can i get The last transaction of each account by using aggregates in Outsystems.?

Hi Aravind,

Use aggregates to apply sorting in DESCENDING ORDER (By ID or Date Field) and get the current value of aggregate record.

Hope this will help :)

Thanks,

AV


Hello Aravind,

The only way I know how to do this with an Aggregate is joining account with transactions and transactions with it again (like in the image), using a filter to return only the records in which Transaction_2.Id is NullIdentifier()

But I STRONGLY recommend you to use SQL in this case, as the aggregate will be doing a cross join and this will be a performance killer while with SQL you can do what you want without resorting to cross joins.

So, this is just an Intelectual Exercise, not something you should be doing.

Resuming, DON'T. Use SQL.

Cheers.