Jump to content

Get number of rows in data table


Recommended Posts

Hello!

 

I need to execute an action on every row in a data table. To write this like a for-loop, I need the number of rows in the table so I can iterate through. Is there a way to get the number of rows in a table without hard coding it? I need this to work generically, where the number of rows in the table aren't fixed. If this isn't possible, is there another way of going about executing something on every row in the data table?

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

Create a dynamic data table with a row counter.  In this way, when adding rows the counter will increase and when removing rows the counter will decrease.  It will even work when adding/removing rows internal to the data table, not just at the end.  Store the row counter in its own data table with one row, Row 0.  Also, store the max number of rows written to and store in the same data table and row as the row counter.  Remember the first row is always Row 0.

 

All processing loops through the row counter.  It will even allow you to loop from the last row to the first row and in reverse.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...