I’m writing in my excel, by appending ranges in each iteration, and by each iteration I need to sort my column in an ascending order.
I’m managing to do it but at one point the column stops to be sorted in an ascending order and I can´t find the problem
Any thoughts on this?
If possible, can you share your workflow?
First, thank you for the response.
Sadly I can´t mate, I´m by it´s confidentiality but I will share and Sample for the Workflow
I´m working on.
For each origin number, I need to organize the rows by sorting in an ascending order, by the column Date of Creation.
What is happening is that it does it correctly until a certain point an then it does not. You can see in the Sample file I´m sharing, row 8 should be after row 5.
Hope you can help me.
Hey @Filipe_Silva! I’m not sure about your scenario, so I’m assuming the following: You append rows throughout the workflow and the expected result is this table in excel sorted by ASC date.
→ In this case, I will suggest the following approach! Insert the lines one by one without worrying about the sort yet. At the end of the whole workflow, read this excel table to a dt, do the sort as I will show next and then write the sorted table again.
Looking better at ordering.
(From row In dt_test Order By row.Item("Date") Ascending Select row).CopyToDataTable
- Result file.
Hope this helps!!!
Hi @gabrielribas4 , thanks for the help.
Unfortunately this does not work in my case, don´t know why because I´m using a query just like you, but I´m doing the following :
Order By DateTime.ParseExact(row(“Date”).toString,“dd-MM-yyyy”, System.Globalization.CultureInfo.InvariantCulture) Select row).CopyToDataTable
With your input:
Order By DateTime.ParseExact(row(“Date”).toString,“dd-MM-yyyy”, System.Globalization.CultureInfo.InvariantCulture) Ascending Select row).CopyToDataTable
But with your input, now my sort is not happening at all and my column Date is disorganized.
But thanks for your input and the help
@Filipe_Silva you need to standardize your dates to date time type.
Look. After read the data, well perform the conversion for each row.
Attention to “Assign”
So then we can use the query.
Note that the date pattern we are using is “dd/MM/yyyy” not “dd-MM-yyyy”
Let me know if it work now!
Adding the .xaml
Main.xaml (9.5 KB)
And the sample.
Report.xlsx (12.6 KB)