One of the great features RB provides is the In-Memory databases (SQLite) and you can use it for this kind of situation.
Create an In-Memory database to store the result recorset and then perform the selects and sorts from this database. You can also create indexes for the columns that are sortable in order to optimize this db when doing a sort. An In-Memory database is very fast and easy to create. Dim db as REALSQLDatabase If db.Connect Then [your code] End If Carlos On Aug 01, 2006 3:54 PM, Chuck Pelto wrote: > On Aug 1, 2006, at 5:53 AM, John Kubie wrote: > > I don't know if this fits, but perhaps an alternative is not to > > sort in the listbox, but to sort using "sortwith". Each column > > would be a one-dimensional array. When the header is pressed, > > the press would be captured and that dimension would become > > the 'sort' column of the sort and all other dimensions become > > the 'sortwith' columns. After the sort you would re-populate > > the listbox. You would also have the arrays you desire. > > Interesting approach, but I don't think it will work in this > instance. You see. I'm working with an SQL cursor here; displaying > the data in the listbox for a list view and in a form for a > form view. > > The problem, as I think, is that SQL does not 'normalize' > activities; > Sorting and Searching. They have to be done together instead of > separately. Each time you want to re-order/re-sort the > data, you have > to do another SQL SELECT statement. > > In order to avoid that, I just do one SQL SELECT statement > and then > sort the records based on their recID (initially) or their > recID, as > found in the re-sorted list, where the first column > [hidden] is the > recID number. I keep the data in a pair of arrays recIDs ; one for > the records found in the SQL SELECT cursor and the other in > the sort > order determined by the end-user clicking on the header of the > ListBox. In order to determine which data should be > appearing in the > form view—whenever the end-user double-clicks a row in the > ListBox or > clicks on one of the First-Next-Prev-Last buttons in the > form view—I > compare the sorted array to the SQL SELECT array to get > which cursor > positioned record should be seen. > > It's more convoluted than I care for, but I think I prefer that to > doing an SQL SELECT each time someone decides they want a > different > sort of an cursor's records. And I don't see the > high-priests of SQL > rethinking their failure to normalize processes any time soon. _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
