Sorting more than 2000 records?

I have a list of over 2000 records that I get using a SQL statement. It won’t let me sort the list because it has more than 2000 records. How do I get around this?

Thanks.

Why don’t you sort it in the sql statement “… ORDER BY …”?

Well, for one, the user might not only want the list sorted by that particular column, but be able to chose which column they would like to sort the list by.

OK, so it is not that YOU can not sort the column but that Servoy doesn’t allow the USER to sort the column?

That is, imho, another question.

How do you offer a user the option to sort on a column?

IT2Be:
How do you offer a user the option to sort on a column?

Via a custom fuction that accesses the controller.sort() fuction.

I never do a sort on sets of this size. As a result I am not sure that you are really not permitted to sort. However, using your own method, isn’t it so that you know a column name and sort method (asc, desc)?

That should make it possible to do a new query. Not ideal but functional…

This is the same conclusion we have come to. :(

This means a lot of reworking of the forms/methods/etc. Ugh.

I have forms that I load via a SQL query and header functions where users can click to sort (using controller.sort).
This works fine even on larger (>10,000) sets of data.

Can you tell us more about how and when you load your data and what do your sort scripts look like ?
Also what back-end database do you use?

We’ve accomplished this functionality at adBlocks by storing the query used to load the form.

You can then provide the user with buttons, or some other custom sort method. From the users input you can then reform your SQL query by replacing the ORDER BY statement with a new one, and reload the data in the form via the new SQL statement.

We’ve been able to use this consistantly for all sorts of queries and sort options, even sorting on columns in foreign tables, even more than one step away (something you’ll have a hard time doing using Servoy’s regular sort options). The more complicated sorts will take a bit of familiarity with SQL and some interesting string manipulations, but it’s definately achievable.

If you call controller.sort(‘column ASC’) Servoy will only do what everybody here is suggesting: firing the original foundset query again with an order by. So you can do all kinds of tricks, but controller.sort() should do exactly the same. So what exactly is going wrong when you use controller.sort()?