298
Views
5
Comments
Sort table with calculated expression not sorting correctly

So i have a table which is populated with data fetched using an SQL Query. A structure was created as an output entity for this query. In one of the columns, there's a calculated expression using 3 of the attributes from that structure with a MoneyFormat function wrapped around them to format in Euros. However, when i test the sorting for the column, some of the values aren't correctly sorted. For instance, when i sort it from largest to lowest, i noticed some negative values mixed among the larger ones. How can i fix this inconsistency?

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi b_pal,

For starters, it would be useful if you would tell us how you do the sorting. Is it part of an Order By in the SQL, or do you sort afterwards e.g. with a ListSort?

UserImage.jpg
b_pal

Kilian Hekhuis wrote:

Hi b_pal,

For starters, it would be useful if you would tell us how you do the sorting. Is it part of an Order By in the SQL, or do you sort afterwards e.g. with a ListSort?

I sort it afterwards using a custom web block.


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi b_pal,

I don't understand what you mean. Can you share an eSpace/OML that shows what you are doing?

2020-01-01 07-11-22
Pravi Gupta

Hi b_pal,

Since you are fetching the data through the SQL query, just make all your calculations in that query, and store that output in one of the structure's column and Alias it. Use that alias name for sorting.

2016-04-21 20-09-55
J.
 
MVP

are you sure it's inconsistent?


if it's a text-attribute then I think it's a correct order. (especially if you added the currency symbol)


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