PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → WebDev19 - Code to change sort order in a table
WebDev19 - Code to change sort order in a table
Iniciado por guest, 15,jul. 2015 00:53 - 4 respuestas
Publicado el 15,julio 2015 - 00:53
Hi all -
I'm sure there's an example for this somewhere, but I can't find it.

My table is sorted on a column, I want to select the column, use up and down arrows to move the selected table row and then change the data in the "sort" Column to reflect the new order for the next time the table is built.

Any ideas appreciated
Publicado el 16,julio 2015 - 03:16
One option is to add a field that stores the sort order integer in increments of 10.

In the [up] button code store the number of the row as it passes or the NextStepRowNumber ( there is a function of this) then store that number minus 5 and resort.

Then scan the table and reset all numbers to increments of 10
Publicado el 16,julio 2015 - 14:18
Thanks Mark!
Publicado el 17,julio 2015 - 12:12
Hi Joel, Hi Mark

personnaly, I do the same kind of things, but I use a high precision numeric instead of the integer...

This allow to
- exchange the values (up and down move)
- insert between (value1+value2)/2 <----- that wouldn't work long with integers, but with high precision numeric, there is no real limit

Best regards
Publicado el 18,julio 2015 - 22:58
Hi Fabrice

Excellent point. I'll do that in future