Edit grid do not support Sort into Query builder however after generating your query you can modify the sort filter but remember once you modify it again you will not be able to use into Query builder.
Here is a screen shot ,
See highlighted screen, By default this sort based on sort column, how ever you can write a If else condition on this saying if sort column is nothing when pay load then sort by CreatedDate ( you can choose your field name) and if click then sort by sort column again into else condition.
Even After adding this it’s not sorting it on the latest records first, and column that I have used is a System built-in field called “UpdateTime”, here’s the screenshot for the same.
Replace your Sort function with the below. “UpdateTime” is the default column in Entity
New SortOption(){addSortOption(“UpdateTime”, Not(False))}
Hello @adiijaiin
I was wondering on the same problem and came across your topic. The exact soluction that @Arvind_Kumar1 didn´t work form me either, but he did gave the idea that eventually let me to the solution… I took what arvind showed and started writing diferent combinations of the expression and I finally got these results. check the cases below.
I cant say I understand the why, and that is part of the reason Im replying your topic, because I want to understand how I can leverage the expressions to be able to make more advance sortings in the future. So I guess my question is for @Arvind_Kumar1
What is the SortColumn property of the grid control?, what exactly does it contain? Because it looks like when I try to display the value on a show message events, nothing comes in the message, but as you can see on the image of the only expression that seems to work, the branch that is taking is the “else”.
Hopefully in further App updates the apps them will tackle this case and make it eassier to handle sorting, and other capabilities which I won´t talk on this opportunity.
Hello @hgaber105 Yes!
As I stated above in my replay I showed a screenshot which has the expression that worked for me for sorting the grid based on the CreateTime field.
Launch the UiPath Apps Studio and open the project containing the Data Grid you want to sort.
Locate the Data Grid component within your app’s interface. You should be able to access it from the design canvas or the component tree.
Ensure that your Data Grid is connected to a data source, such as a database, Excel file, or any other source where the data is stored.
In the properties panel for the Data Grid component, look for options related to sorting. Depending on the capabilities of the Data Grid component you’re using, there may be built-in sorting options available.
If sorting options are available, you may need to enable sorting functionality for the Data Grid. This could involve toggling a setting or selecting a sorting mode (e.g., ascending or descending).
Define Sorting Criteria: Specify the criteria based on which the data should be sorted. This could involve selecting a specific column or field to sort by.
Test Sorting Functionality: Save your changes and test the sorting functionality within the UiPath Apps preview mode or by running the app in a testing environment. Verify that the data is sorted correctly according to your specified criteria.
Refine and Iterate: If necessary, refine your sorting configuration and repeat the testing process until you’re satisfied with the results.
Publish Changes: Once you’re happy with the sorting functionality, publish your changes to make them available in the live version of your UiPath App.
In case someone else comes across this as I did, in my testing the default value for SortColumn is “”. If you click to sort a column ascending, then descending, then click again to go back to the default order, SortColumn is then nothing. So, what worked for me on the sort option is
If(MainPage.EditGrid.SortColumn is nothing or MainPage.EditGrid.SortColumn = "","CreateTime",MainPage.EditGrid.SortColumn)