Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren, 9 Monaten
Letzter Beitrag:
vor 2 Jahren, 9 Monaten
Beteiligte Autoren:
Fabrice Harari, Allard

table rows table insert

Startbeitrag von Allard am 24.09.2015 08:25

Hi I havethe following issue.

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.


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



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

von Fabrice Harari - am 24.09.2015 09:49
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.