Hi everyone,
I have a list in my Outsystems app that may contain duplicate records, and this is intentional—I want to display and manage them in the UI as-is. However, when I click the Download button to export this list to an Excel file (using the Advanced Excel Forge component), I need to exclude the duplicates from the Excel file.
Is there a way to remove duplicates only during the export process, without affecting the list data shown on the screen?
I'm looking for a clean and efficient approach to handle this in a server action before generating the Excel.
Any help, logic suggestion, or sample would be appreciated!
Also I am attaching my OML File, Just go through the file.
Thanks in advance.
Hi Sagar,
You can probably use ListDistinct just before the iteration, it will list out all the unique combinations your aggregate is having.
If you strictly want to use Advance Excel, then you should use Formula action just like below. It's excel formula which will be applied based on the row and column even when you applied to single cell it will be applied to the range you would select which is described below, please give it a try.
In the below it just explains that (=UNIQUE Records only which lies between A1 i.e., First Coloum, Fist Row and E10, 5th Coloum and 10th Row) make sure to change the E10 dynamically based on your number of rows. I haven't tried but give it a try, it should work.
Let's me know if you really want me to give it a try.
Hi @Drishti Menghani ,
I am Also trying both ways, Ill Used ListDistinct But is storing only one record.
And also Tried Cell_SetFormulaByIndex but I cant get proper result.
Could you please try for me.
Hello.
A simple solution would be to store in a temporary SQL table.
If they have IDs, the insert ou update would remove the duplicates, then you just export.
If they don't have Ids, export with distinct and that's it.
If it is for a single user, don't forget to truncate the table after each use.
If multiple users can call it, you have to log the request, mark each record as a child of that request, and also clear at the end.
Hi @Nuno Reis ,
Thanks a lot for your reply!
I'm still new to OutSystems, so I didn’t fully understand your explanation. Could you please explain it in a simpler way or maybe step-by-step? If you can show where to put the logic in Service Studio (like in Server Action or Aggregate), that would really help me understand better.
Thanks again for helping!
Looking at your code, all you need is a Group By. I changed the Aggregate and corrected the Assigns.
Without Group by isn't possible to complete this requirements using advance excel.
You can get this with a group by. I also took a look at your code and in your case the advanced excel tool is not needed, you can use the built in recordlistToexcel. I put an example below.
Hi @Nick Vandebriel ,
Is it possible to achieve this requirement using the Advanced Excel component without using a Group By operation?
You can take a look on the list distinct function. But is there a reason you don't want to use a group by?
I Used Group By, But I am Trying To achieve In Another Way, So for that I am Exploring Advance Excel.
Isn't Possible Using Advance Excel?
Do you see any action in Advance Excel for Remove Duplicates?
Your best option would be to load a table into Excel, use it as source for a pivot table, and do the same thing on Excel with two sheets, one of duplicate entries and one of single entries.
Do it on SQL that is the tool for it.
I Don't Know is there any action in Advance Excel ,
How to do that Using SQL Tool.
Could you please elaborate.
That's my point. There is no action for it. Advanced Excel is to manipulate the format of output, not to generate the data.
You can do it in SQL, but you can also do it in an Aggregate like I explained yesterday. If you already have the ideal solution, why do things in a more complex way?