List Sort Column for Group By Columns of Aggregate

Hi,

How to use List Sort column widget for the columns that are available as a result of using group by in aggregate ?

Lets say table name is Student and column on which i used group by is Age. Before using ' group by ', to sort the age column in table using 'list_sortColumn' widget, the input I passed is  "{Student}.[Age]" and using List_SortColumn_GetOrderby(table.id) in aggregate sorting.

But when a group by on age column is done, what needs to be the input to the list_SortColumn.

I have tried using  below,

{Student}.[Age], 

[Age],

Age (this is the name of the grouped by attribute) which did not work. Is there anything that I am missing.


Thanks in advance.


- Sai

Marco Arede wrote:

Hi sai teja Yeniganti ,

Maybe the instructions in this document can help you:

https://success.outsystems.com/Documentation/How-to_Guides/Development/How_to_use_the_List_Sort_Column_Widget_with_a_SQL_query

Or even this answer here:
https://www.outsystems.com/forums/discussion/42228/sorting-columns-dynamically-by-using-listsort/

Cheers!

 Hi Marco, 

Thanks for taking time and replying.

The first link is sorting when a SQL is used, which I am already aware of. I just want to achieve the same using an aggregate, if there is one,  when group by is used. 

The second link just consists of the usage of list_sort column widget.

I want to know how to sort a column from aggregate when a group by is used.


Thanks,

Sai


 

When you pick attributes for a Sort, you can see the aggregate name in a different color. Like it is in a structure and not from entity..

I don't have present howI've done it, but using just column name, "Age", should work.

You can always do the test in Service Studi to be sure.



Solution

Hi sai teja Yeniganti ,

Now I got more understanding on what was your problem.

Adding to what Nuno said before, here is an example of what you need to do (for sorting a grouped column):

1) Provide a name to the new column (e.g. "NewName")

2) Delete the sort expression and create a new one similar, but only with "NewName" in the place where was before the {tableName}+[columnName] (because this will re-generate the executed SQL)

3) Finally, provide this new name also to the table widget List_SortColumn:

Let us know if you have solved your problem! 

Cheers!

Solution

Marco Arede wrote:

Hi sai teja Yeniganti ,

Now I got more understanding on what was your problem.

Adding to what Nuno said before, here is an example of what you need to do (for sorting a grouped column):

1) Provide a name to the new column (e.g. "NewName")

2) Delete the sort expression and create a new one similar, but only with "NewName" in the place where was before the {tableName}+[columnName] (because this will re-generate the executed SQL)

3) Finally, provide this new name also to the table widget List_SortColumn:

Let us know if you have solved your problem! 

Cheers!

 Hi Marco,

I have multiple group by columns and for one of the column i tried like you mentioned, but still not able to sort.

Just curious,from the above screenshots, the way you have tried to implement, were you able to sort ?


Thanks & Regards,

Sai

Nuno Reis wrote:

When you pick attributes for a Sort, you can see the aggregate name in a different color. Like it is in a structure and not from entity..

I don't have present howI've done it, but using just column name, "Age", should work.

You can always do the test in Service Studi to be sure.



 Hi Nuno,


I have already tried this, but still no luck. 


Steps which I followed :

1) Used group by for few columns in aggregate.

2) in the sorting tab in aggregate, List_SortColumn_getorderby(table.id,"columnName") / List_SortColumn_getorderby(table.id) (since the second parameter is to give a default value), tried using both.

3) in the UI table, used a list sort columnn widget and gave the input as column name. 

(Table refresh, ajax refresh every other thing is fine.)


Thanks,

Sai

 

It worked with me.

I sorted by all 3 fields and it worked...


Hi sai teja Yeniganti

Also works with me!

Did you make step number 2? You need to remove the sort expression of the aggregate, and create a new one. It's really important to do so (see my explanation above).

After checking Nuno's solution, if it does not work on your side, you can send us the OML file and we'll help you.

Good luck!

Marco Arede wrote:

Hi sai teja Yeniganti

Also works with me!

Did you make step number 2? You need to remove the sort expression of the aggregate, and create a new one. It's really important to do so (see my explanation above).

After checking Nuno's solution, if it does not work on your side, you can send us the OML file and we'll help you.

Good luck!

 Hi Marco, 

Thanks for the explanation.

I have removed the sort expression from the aggregate and create a new one, and its working fine now. 


Thankyou,

Sai

 

Well done sai teja Yeniganti and credits also to Nuno Reis for the details into the problem! 

Good work! :)