Hi everyone!
I have a screen that displays a table based on an aggregate. It includes many filters, a search function, and pagination. I need to add a button to this screen that allows users to export the aggregate results - with all applied filters and search - but without pagination (i.e., export all matching records). What’s the best way to implement this?
My second question is: how can I customize the column names and the order of columns while exporting to Excel? Do I need to use one of the Forge components for that?
I use ODC
Hello.
You must go server side to run the RecordListToExcel. And sending the list from screen to the server is a waste of bandwidth. The easiest way to export all is to run the same aggregate server-side without max records and return it as a binary.
To customize columns you just need to create a structure with those column names and sequence, and map the Aggregate to it. Easy and no extras. If you need a more complex excel (with styles, images, and so on) then you need components.
Thank you for your response!
I have one more question: what if users should be able to select which columns they want to export to Excel and in what order?
You can pass the selected columns and order to the server, then build the Excel dynamically based on that. Loop through the data and add only the chosen columns in the right order before exporting
Hope it help you.
For that you will need components. Try Excel Library.
Hi
You can create a copy of the same aggregate to use in the Export button logic, pass the same search parameters as input, and remove the Max Records property.
To customize the column names and order, you’ll need to implement some custom logic. I'm not aware of a specific Forge component for this, but if I come across one, I’ll share it here.
Thanks,
Sachin