Forum > Databases

Problems sorting a DataSet

(1/3) > >>

jciberta:
I have problems sorting a DataSet with IndexFieldNames. I don't know if it's a bug, or I'm doing something wrong.

The code is:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  //SQLQuery1.IndexFieldNames:='Title DESC'; // Works fine!  //SQLQuery1.IndexFieldNames:='Title; LastName'; // Works fine!  SQLQuery1.IndexFieldNames:='Title; LastName DESC'; // WRONG: Order Title by DESC!     
I'm using Ubuntu 18.04 with Lazarus 2.0.12 (the newest at this moment). The database engine is SQLite with Chinook database (https://github.com/lerocha/chinook-database).

A sample program is attached.

I need to know if IndexFieldNames works properly or if there is a bug. Change SQL is not an option.

Thanks in advance

jciberta:
I just find out if you set the value of IndexFieldNames twice, it works.

That is:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  //SQLQuery1.IndexFieldNames:='Title DESC'; // Works fine!  //SQLQuery1.IndexFieldNames:='Title; LastName'; // Works fine!  SQLQuery1.IndexFieldNames:='Title; LastName DESC'; // WRONG: Order Title by DESC!  SQLQuery1.IndexFieldNames:='Title; LastName DESC'; // Do it twice -> Works properly! 
So, it seems to me a bug. I do not know how to report it, any help would be appreciated

Lutz Mändle:
The string for IndexFieldNames should not contain any other spaces then before DESC, like this:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SQLQuery1.IndexFieldNames:='Title;LastName DESC'; 

jciberta:
Still not working. It persists in order Title by DESC.

I tried now on a Windows 10, Lazarus 2.0.10. The same behaviour

MarkMLl:

--- Quote from: jciberta on May 12, 2021, 05:29:41 pm ---So, it seems to me a bug. I do not know how to report it, any help would be appreciated

--- End quote ---

You'll find https://bugs.freepascal.org/bug_report_page.php fairly painless. Sorry I've not been able to help any more than that.

MarkMLl

Navigation

[0] Message Index

[#] Next page

Go to full version