UnDiUdin
UnDiUdin

Reputation: 15394

Sort a Delphi dataset

I have an unsorted dataset (a TMSQuery from Devart) that I cannot sort using ORDER BY because I manipulate the records after opening the query so the order given by "ORDER BY" is lost.

I don't want to rewrite the whole logic so I should find a way to sort a dataset.

I can Assign the dataset to a TMemDataSet (TMemDataSet is a DevArt class) descendant (TVirtualTable from Devart), but after this how do I sort (I need to sort by a date field)?

I read this question but it doesn't relly contain the answer I am looking for.

Upvotes: 4

Views: 13373

Answers (1)

UnDiUdin
UnDiUdin

Reputation: 15394

Using IndexFieldNames I solved the problem, it was what I waslooking for. Directly from the TMSQuery component:

MSQuery1.IndexFieldNames := 'EXECUTION_DATE'; //this does the job

Upvotes: 9

Related Questions