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?


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

Hi Catarina,

Can you show your OnSort action?

Also, is the database field called "usr_username"? 

Here it is:


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


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

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

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

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".

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





Thank you very much, doing that worked!

Thank you very much Dorine for the explanation šŸ˜Š

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?

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.