PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → table rows table insert
table rows table insert
Iniciado por guest, 24,sep. 2015 10:25 - 1 respuesta
Publicado el 24,septiembre 2015 - 10:25
Hi I havethe following issue.

A
I add rows to a table but I would like to be able to insert a row. So user can define the order.

So To achief this I have to find out the rownumbers of each row in the table and after the user has inserted a row save alle the rows of the table with the specific row position in order to get the order when I load the entry when The user selects this particular entry again.

example

row 1 pete
row 2 jan
row 3 lucas

then the user wants to insert a name at the second position

He inserts row and adds gerald

the table isnot saved yet but on screen this looks like this:

row 1 pete
row 2 gerald
row 3 jan
row 4 lucas

So I need to save this with a rownumber and when I retrieve the entries I have to order on that rownumber. For the ID of gerald is 4

This would be easy If I could add to each row the rownumber as it is presented. But I cannot find a function for that.

I hope this all makes sence

Regards
Allard
Publicado el 24,septiembre 2015 - 11:49
Hello Allard,

I'm not sure if you are talking about a table control or file, here.

In both cases, what I do for this kind of problem is to use a high precision numeric istead of an integer.

Adding a row at the end works th same than with integers (previous value+1)
inserting before a line becomes very easy : (value of previous row+value of current row)/2

this works for a file index, and for a table control, you just need to make sure that the table is sorted on that value (this column doesn't need to be visible, by the way)

Best regards