How to convert the record list into aggregate

How to convert the record list into aggregate

  

Hello team,

             I have created one server actions which returns List of records. I have mapped in to list. In my screen search option is there. How to add search option on list of records.

Or,

               Is there any way to convert to list of records in to aggregate, So that i can filtered easily using aggregate. 

Thanks in advance,

Saravana

Hello Saravana,

If i understand you correctly you could use a ListFilter to filter your record list.

A other way would be to foreach over all the records of the list and save these in a table and then use the aggregate function search to get your desired results.

I hope this answered your question

Kind Regards

Didier Leroy

Hi Saravana,

An Aggregate is converted to an SQL query that is sent the database. The result that the database returns is converted to a Record List. Filtering happens inside the database, based on data in database tables ("Entities"), in the database server. A List is a memory structure in C# or Java that lives in the memory of the front-end server. You cannot "convert" a List to an Aggregate, just as you cannot convert a house to the blueprint of a condo.

That said, if your List is small(ish), like Didier said, you can use ListFilter to filter the List. But, since you have a Server Action that produces that List, why don't you let that Server Action do the filtering?

Hi Saravana,


 So, currently you have an action that outputs a list of records, in that action dont you create the list of records using a Aggregate/aggregates? If so, why not filter on that aggregate and then you output the list of records technically already filtered!


 If not, then why not use listfilter?