538
Views
10
Comments
Solved
On Sort not working
Question

Hello,

I have another issue with table sorting not working.

My table has the OnSort event:

The table columns have Sorting Attributes:

The aggregate has the TableSort as a dynamic sort:

I thought these 3 things should be enough, but when I click a column (any of them), nothing happens.

Any suggestion?


2024-11-20 08-28-20
Pedro Marques
Solution

I know this sounds stupid, but on the "Sorting" tab of your aggregate, delete the "TableSort" and then add exactly the same variable. Try it in the Test values and then let me know

2024-11-20 08-28-20
Pedro Marques

Hi Catarina,

Can you show your OnSort action?

Also, is the database field called "usr_username"? 

UserImage.jpg
Catarina Gomes

Here it is:


Yes, this aggregate has 4 sources with 3 joins but the usr_username is a column in the database.


2024-11-20 08-28-20
Pedro Marques

If in the Test Values of the aggregate you enter "usr_username" the sort works like it's supposed to? 

UserImage.jpg
Catarina Gomes

No, it doesn't (i've tried both with card number and user name).

2024-11-20 08-28-20
Pedro Marques
Solution

I know this sounds stupid, but on the "Sorting" tab of your aggregate, delete the "TableSort" and then add exactly the same variable. Try it in the Test values and then let me know

2021-10-09 07-57-44
Stefan Weber
 
MVP

Just to make sure. you entered usr_cardnumber as sort attribute, but your column is user_cardnumber. In addition i think that the dynamic sort should include the entity name, so it would be "fat_Users.user_cardnumber".

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Pedro is giving the solution.  This is a known bug in Outsystems when adding grouping to your aggregate that uses dynamic sorting.  You can clearly see this in the executed sql of your aggregate.


After adding grouping, and before deleten and re-adding the dynamic sort :

SELECT TOP (12) [ENSAMPLE_EMPLOYEE].[FIRSTNAME] [EMP_FIRSTNAME], [ENSAMPLE_EMPLOYEE].[ID] [EMP_ID], [ENSAMPLE_EMPLOYEE].[LASTNAME] [EMP_LASTNAME], Sum([ENSAMPLE_ACCOUNTS].[OVERDRAFT]) [ACC_OVERDRAFTSUM]

FROM ([EDJUWJ010].dbo.[OSUSR_MLE_SAMPLE_EMPLOYEE] [ENSAMPLE_EMPLOYEE]

Left JOIN [EDJUWJ010].dbo.[OSUSR_MLE_SAMPLE_ACCOUNTS] [ENSAMPLE_ACCOUNTS] ON ([ENSAMPLE_EMPLOYEE].[ID] = [ENSAMPLE_ACCOUNTS].[CREATEDBY])) 

GROUP BY [ENSAMPLE_EMPLOYEE].[FIRSTNAME], [ENSAMPLE_EMPLOYEE].[ID], [ENSAMPLE_EMPLOYEE].[LASTNAME]


After deleting and re-adding the dynamic sort:

SELECT TOP (12) [ENSAMPLE_EMPLOYEE].[FIRSTNAME] [EMP_FIRSTNAME], [ENSAMPLE_EMPLOYEE].[ID] [EMP_ID], [ENSAMPLE_EMPLOYEE].[LASTNAME] [EMP_LASTNAME], Sum([ENSAMPLE_ACCOUNTS].[OVERDRAFT]) [ACC_OVERDRAFTSUM]

FROM ([EDJUWJ010].dbo.[OSUSR_MLE_SAMPLE_EMPLOYEE] [ENSAMPLE_EMPLOYEE]

Left JOIN [EDJUWJ010].dbo.[OSUSR_MLE_SAMPLE_ACCOUNTS] [ENSAMPLE_ACCOUNTS] ON ([ENSAMPLE_EMPLOYEE].[ID] = [ENSAMPLE_ACCOUNTS].[CREATEDBY])) 

GROUP BY [ENSAMPLE_EMPLOYEE].[FIRSTNAME], [ENSAMPLE_EMPLOYEE].[ID], [ENSAMPLE_EMPLOYEE].[LASTNAME]

ORDER BY Emp_LastName


@Stefan Weber : for grouped or calculated data coming out of the aggregate, it is normal that there is no entity qualifier in the tablesort name.

Dorine




UserImage.jpg
Catarina Gomes


Thank you very much, doing that worked!

Thank you very much Dorine for the explanation 😊

2021-05-21 21-56-03
Anderson!

I suppose your action looks like the image below. If correct, would removing 'cap_Avaliations.next_avaliation' as a sorting attribute change the behaviour when clicking upon one of the columns?

UserImage.jpg
Catarina Gomes

I've removed cap_Avaliations.next_avaliation sorting and it's still the same behaviour.

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