Page 1 of 1

TZReadOnlyQuery preserves sorting without preserving sorting...?

Posted: 02.06.2022, 10:39
by aehimself
Am I the crazy here or something fancy is going on :)

I have a TZReadOnly query, with the following SQL:

SELECT [...] FROM MyTable WHERE SomeField = :pID ORDER BY ID ASC

When the user changes to a different option, the query is closed, parameter value is updated and is being reopened.
All is connected to a DBGrid.

The strange thing happens when there is sorting enabled, take a look at the screenshots:

Initial state, can be seen it's ordered by ID nicely:
OrderbyID.PNG
Now, let's manually sort it by LastChanged:
OrderByLastChanged.PNG
Now select a different option, closing and reopening the dataset:
OrderByWhatNow.PNG
The gird is not incorrect, DataSet.SortedFields is indeed empty, it should be sorted based on the SQL query (by ID).
So the sorting was somehow preserved internally, but externally it appears to be unsorted...?

Am I going nuts here, or I just messed something up badly? Can someone confirm this, please? :D

Re: TZReadOnlyQuery preserves sorting without preserving sorting...?

Posted: 02.06.2022, 13:12
by aehimself
Please disregard this post. The issue was me, leaving a tiny piece of code somewhere else which manually reset the .SortedFields property.
Zeos is working fine, I just need to sleep more... :(