38
Views
11
Comments
Solved
Sorting in data action's output variable
Question

I am using data action's output variable as a source in my table i want to apply sorting in it i have tried ListSort but it was too not working please help

Solution

First, i make a structure that holds a boolean attribute for  all attributes that i want to sort by.

Second, we make a variable in our page of the Datatype 'SortByOrder' to track the current sorting state of each sortable attribute (ASC or DESC) if its asc the value is true, if its DESC the value is False.



When you click a column, the value of the attribute that corresponds to the clicked column should be changed to the opposite.

Example below:


After that, you use a listSort widget to sort the table using the parameters as seen above.


I hope this helps !
Regards

Do you want to sort the list inside the data action itself, or let the user sort the table?


if you want to sort the list before assigning it in the table you should use the ListSort widget inside your data action.

If you want to let the user sort the table by different attributes you can check the following link:
Sort table

I want to allow user to sort the table

It doesn't help i want to apply sorting in data action's output variable which i am using as a source in my table and i want to apply sorting in this table this is what i want

Lets say your output variable is called 'List'.
You can use the variable 'List' as the source of your table.
Just change the 'GetEmployees' Aggregate in the example to the 'List' output variable of your data action. 
Change GetEmployees.Count to 'YourVariable'.Count
You can also select the attributes that correspond to your variables object type in the 'Sort Attribute' inputfield. 
Again, you should be able to solve the problem using the documentation provided. Just change the GetEmployee aggregate to your List variable.

Hope this helps 

This is now how it works for the list the properties for list and aggregates are different we are passing TableSort element in the aggregate sort option we doesn't have this in list

You are passing the 'ClickedColumn' as SortBy variable to the CustomOnSort Client action.
You need to fill in the 'Sort Attribute' for each column you want to sort.

It works just fine, this is an example where i use a data action output variable as source of my table and implement the Sorting functionality.

You need to try and comprehend the  flow

how do we manage aesc and desc order in this flow can you please explain

Solution

First, i make a structure that holds a boolean attribute for  all attributes that i want to sort by.

Second, we make a variable in our page of the Datatype 'SortByOrder' to track the current sorting state of each sortable attribute (ASC or DESC) if its asc the value is true, if its DESC the value is False.



When you click a column, the value of the attribute that corresponds to the clicked column should be changed to the opposite.

Example below:


After that, you use a listSort widget to sort the table using the parameters as seen above.


I hope this helps !
Regards

Thanks @Thibaut G It really helps i was stuck in it for so many days and now by your method it is like a piece of cake

Hi Piyush,

I am attaching a simple example demonstrating how to use list sort with data action for your usecase.

I hope this helps!

https://saravanan-gamechanger.outsystemscloud.com/Practice/SortingDataAction?_ts=638300306898586852

Regards,

Saravanan Santhanam

Practice.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.