Skip to main content
Solved

Column sorting date doesnt sort accordingly


Dennis1690
Vanguard
Forum|alt.badge.img+4

Hi, I'm fresh, sorry for any mistakes.

Usecase: Users want to column sort respective tables on date, this doesnt work as we intended. (Screenshot below post)

What doesnt work?  

  1. Datenotation(timezone) in the date domain (widely used) is set to local (Netherlands) but the grid still shows a MM/DD/YYYY Notation. 
  2. Sorting doesnt seem to work as intended. It drops a random 2022 row between a 2023 rows. 

What have I tried?

  1. Tried to set the datenotation(timezone) to ‘Show as stored’ and back to ‘Local’.
  2. Tried looking for hidden sorts on the grid, there isnt any.
  3. Checked if the date is stored as something different than a date (like string, int, etc)

When is my problem solved?
The moment sorting works again as intended, even better would be a small explanation why it does(n't) work.

 

Thanks in advance.

 

Best answer by Anne Buit

Hi Dennis,

Does the order-by part in the query corresponding to the data selection shown in the database event log shed any light on the cause?

 

The DB event log. If this option is not present, ensure your account is configured for Developer Mode in IAM

You can execute the same query as shown in the database event log directly on the database and check if it shows the same ordering discrepancy.

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

2 replies

Anne Buit
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • 637 replies
  • Answer
  • November 15, 2023

Hi Dennis,

Does the order-by part in the query corresponding to the data selection shown in the database event log shed any light on the cause?

 

The DB event log. If this option is not present, ensure your account is configured for Developer Mode in IAM

You can execute the same query as shown in the database event log directly on the database and check if it shows the same ordering discrepancy.


Dennis1690
Vanguard
Forum|alt.badge.img+4
  • Author
  • Vanguard
  • 25 replies
  • November 24, 2023

It did and it confirmed what I thought. The date is being converted to a varchar, which changes the sorting from date to string. This line.

cast(convert(varchar(11), start_date, 105) as nvarchar) as sd

 

Now its just finding the source of the convert and fix that.

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings