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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.