Clearing DataSet.IndexFieldNames without restoring original order?
Clearing DataSet.IndexFieldNames without restoring original order?
In build 9.5.16 the IndexFieldNames behavior when clearing the property was changed to revert to the original sort order. In prior builds setting IndexFieldNames and then clearing it caused the dataset to retain its last set sort order but to no longer be actively sorted. This was actually useful when editing in a grid as the user could choose to sort the dataset, and then edit it without records moving around (jumping to their actively sorted position) as they were changed (or inserted). Is it possible to clear IndexFieldNames and retain the current order? Alternately, is there some other way to sort a dataset and then set the dataset so that changed records aren't actively sorted? I hope this question is clear but I'll be happy to clarify if it is not. Thank you for any suggestions.
-Mark Ford
Benthic Software
-Mark Ford
Benthic Software
Re: Clearing DataSet.IndexFieldNames without restoring original order?
Hello,
No, the behavior you expect is incorrect. On any change of IndexFieldNames (even on setting an empty value) the dataset must be sorted again, and the cursor must remain on the current record.
No, the behavior you expect is incorrect. On any change of IndexFieldNames (even on setting an empty value) the dataset must be sorted again, and the cursor must remain on the current record.
Re: Clearing DataSet.IndexFieldNames without restoring original order?
Although you may consider it incorrect, the behavior was like that for years and years. With the new behavior it isn't possible to sort a dataset before editing it in a grid (imagine what happens when you paste a block of data into a grid that is being actively sorted during the paste.) So imagine the scenario:
User runs a query.
User clicks a grid column to sort the dataset (let's say by date.)
User decides to edit the data in a datagrid by pasting in a block of data.
(at this point we must clear IndexFieldNames or the records will try to actively sort during editing.)
Suddenly the data goes back to the original sort order, instead of the old behavior of retaining the sort.
This is a big lost feature! I now have to explain to users that they can no longer change the sort order of a dataset before editing it.
I can imagine that being able to return to the original sort order is a nice feature, but there should be a different way to do it (i.e. a function called "RevertSortOrder" or a special value that IndexFieldNames can be set to such as "REVERT")
Alternately we need a new property that sorts the dataset without turning "active sorting" on (this was always achieved by setting IndexFieldNames and then clearing it.) A new properly called "SortByFieldNames" with the same syntax handling as the current IndexFieldNames would be perfect.
If it's truely the case that the old behavior was a bug, please (with a capital P) consider a new sorting feature that gives us back this ability!
-Mark Ford
Benthic Software
User runs a query.
User clicks a grid column to sort the dataset (let's say by date.)
User decides to edit the data in a datagrid by pasting in a block of data.
(at this point we must clear IndexFieldNames or the records will try to actively sort during editing.)
Suddenly the data goes back to the original sort order, instead of the old behavior of retaining the sort.
This is a big lost feature! I now have to explain to users that they can no longer change the sort order of a dataset before editing it.
I can imagine that being able to return to the original sort order is a nice feature, but there should be a different way to do it (i.e. a function called "RevertSortOrder" or a special value that IndexFieldNames can be set to such as "REVERT")
Alternately we need a new property that sorts the dataset without turning "active sorting" on (this was always achieved by setting IndexFieldNames and then clearing it.) A new properly called "SortByFieldNames" with the same syntax handling as the current IndexFieldNames would be perfect.
If it's truely the case that the old behavior was a bug, please (with a capital P) consider a new sorting feature that gives us back this ability!
-Mark Ford
Benthic Software
Re: Clearing DataSet.IndexFieldNames without restoring original order?
All data access components behave in the same way (you can make this sure using the standard components - FireDAC). We have modified this behavior due to user requests.
The way you are suggesting is rather strange behavior. Because when modifying data, it will be displayed incorrectly taking into account the filter
The way you are suggesting is rather strange behavior. Because when modifying data, it will be displayed incorrectly taking into account the filter
Re: Clearing DataSet.IndexFieldNames without restoring original order?
Well, regardless of that, I've relied on this behavior for years. Your comment about "Because when modifying data, it will be displayed incorrectly taking into account the filter" is a misunderstanding of the issue. An active "filter" (I call it "Active sorting") needs to be turned off in any case for grid style editing. Unfortunately now it means that the data reverts to the original sort order instead of maintaining the sort. Basically I used the "feature" as a way to turn active sorting off and yet maintain the current sort order. Regardless of whether the previous behavior was a bug, the loss of this ability is a real problem (and I'm going to catch a lot of complaints over it.)
So assuming that you don't agree with the above (for whatever reason), how about adding the ability to turn active sorting off? It seems like this ability would be very useful. Or add a sort feature that just sorts the dataset but does not turn "Active sorting" on. This feature would solve this problem nicely (and perhaps it's easy to implement since it always worked that way before.)
So assuming that you don't agree with the above (for whatever reason), how about adding the ability to turn active sorting off? It seems like this ability would be very useful. Or add a sort feature that just sorts the dataset but does not turn "Active sorting" on. This feature would solve this problem nicely (and perhaps it's easy to implement since it always worked that way before.)
Re: Clearing DataSet.IndexFieldNames without restoring original order?
The FireDAC documentation
http://docwiki.embarcadero.com/RADStudi ... FireDAC%29
states:
To sort dataset by original records order (as the records were fetched and /or appended), use '#' as a value for IndexFieldNames and Fields properties.
If that's correct, how about matching their convention? That would seem to be the best of both worlds (allowing a return to the original sort order while also allowing us to maintain the current sort order while turning "active sorting" off.)
-Mark Ford
Benthic Software
http://docwiki.embarcadero.com/RADStudi ... FireDAC%29
states:
To sort dataset by original records order (as the records were fetched and /or appended), use '#' as a value for IndexFieldNames and Fields properties.
If that's correct, how about matching their convention? That would seem to be the best of both worlds (allowing a return to the original sort order while also allowing us to maintain the current sort order while turning "active sorting" off.)
-Mark Ford
Benthic Software
Re: Clearing DataSet.IndexFieldNames without restoring original order?
In our products, to return sorting to the initial level (as returned by the database), you should just clear IndexFieldNames.
If you want us to implement any feature, you can leave a suggestion to extend functionality at our uservoice forum: https://devart.uservoice.com/forums/104 ... components .
If you want us to implement any feature, you can leave a suggestion to extend functionality at our uservoice forum: https://devart.uservoice.com/forums/104 ... components .
Re: Clearing DataSet.IndexFieldNames without restoring original order?
Well obviously that's a very disappointing answer after I've spent so much time explaining the issue. So there's no longer a way to turn off active sorting without reverting the dataset to the original sort order... even though ODAC has allowed this for years... great.
Re: Clearing DataSet.IndexFieldNames without restoring original order?
If you have a source version, we can tell you where to change the code to get the old incorrect behavior.
Re: Clearing DataSet.IndexFieldNames without restoring original order?
Thank you, I've already done so. This would make a nice option I'd think (and very easy to implement.)
Re: Clearing DataSet.IndexFieldNames without restoring original order?
We will consider the possibility to add such option in one of the next versions.
Re: Clearing DataSet.IndexFieldNames without restoring original order?
Hi, is such version already available? (I need it in SDAC)
Or, at least, would you mind publishing the needed change in sources?
Thanks, Ludek.
Or, at least, would you mind publishing the needed change in sources?
Thanks, Ludek.
Re: Clearing DataSet.IndexFieldNames without restoring original order?
To restore the old behavior you need in the MemData module to change the TMemData.SortItems method as follows:
from the condition
delete the check
from the condition
Code: Select all
if (IndexFieldsCount = 0) and not FOrderSaved then
Code: Select all
and not FOrderSaved
Re: Clearing DataSet.IndexFieldNames without restoring original order?
Thank you very much, I'll try!
Ludek.
Ludek.
Re: Clearing DataSet.IndexFieldNames without restoring original order?
If you have any other questions, feel free to contact us