on 03-16-2005 11:52 AM
Hi,
I have a UserTabele and I want read data from the table to a matrix. It's no problem. But how I can sort data when I use DBDataSource.DoQuery( Condition )? I want use something like "order by" in SQL, but data are getting
according by filed 'Code'. Any suggestions?
Regards
Tomasz Tura
does anybody have the "CODE"....for sorting the userdatasource???
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below is an outline of a technique I used to add sorting to an existing add-on screen that had been written a long time ago using DBDataSources. Although not particularly efficient, the biggest advantage of this technique is that hardly any of the existing code was changed avoiding a lot of extra testing.
Original code was along the lines of
- Set up DBDataSource Conditions
- DBDataSource.Query
- for counter = 0 to (DBDataSource.Size - 1)
- Set offset on DBDataSource to loop counter
- Set some values to UserDataSources
- Matrix.Addrow
- next
I simply introduced a 2 dimensional array to the above, writing the offset and the sort field from the DBDataSource to it. Performed a Quicksort on the array, and then changed the "Set offset on DBDataSource to loop counter", to instead use the pick up the appropriate offset from the sorted array.
New code is along the lines of
- Set up DBDataSource Conditions
- DBDataSource.Query
- **Populate Array & Quicksort it**
- for counter = 0 to (DBDataSource.Size - 1)
- Set offset on DBDataSource to **offset from Array**
- Set some values to UserDataSources
- Matrix.Addrow
- next
(NB. The actual code has lots of calculations and additional rules filtering the data so is a bit too complex to easily illustrate the technique)
John.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I also need such a functionality.
Have you already found a solution?
Or anyone else?
Kind regards
Iris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.