Diese Seite mit anderen teilen ...

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

retrieve the row number of a table

Startbeitrag von Allard am 28.11.2010 20:45

Hi,

I would like to get the row numbers of a table and display the number of the row in the row in a Colum called number.
When I add a new row I would like to display 1 in the first row and 2 in de second row. Why not display the id. Well I need to be able to move the rows of the table. So the user can change the order of the items that are displayed .Each row has to hold the id that has been given to it automatically. Because other files are linked to this id.
I want to include the extra Colum with the row number so I can use it to sort on in a query.
I found a function in the help that should do the job but it does not ?

The help file:
RowNum is int = CurrentSubscript()
Trace("Number of the current row: " + RowNum)

= CurrentSubscript()
________________________________________
: Integer
• Number of the current row displayed in the current table.
• Number of the option in the current check box.
• Subscript of the current subscripted control.



Use in the processes of a table
When initializing a table, the "Row display" process is run whenever a row is displayed in the table. When initializing the table, if CurrentSubscript is used in the "Row display" process, CurrentSubscript returns 0.


I have a button to run the code so I do not use it in a process of a table. But the currentsubscript does return 0 instead of the row number of the selected table row

Can you help me out. if my way is not a good way the get the job done, if you have an other approach that Works well please tell because I have spend half a day and did not succeed

Thanks,




Antworten:

Hello Allard

We always use a separate numbering process for this, not the row subscript. It can get out of sequence if the users add their own numbers but generally the tablecount() + 1 will give the next number. If you provide a "renumber" button then the user can sort the table on other columns and renumber the lines to suit that order, which is often handy.

Regards
Al



von Al - am 29.11.2010 00:22
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.