Jump to content

assigning tags repeatedly to different sections of table

Sundaram Sridharan

Recommended Posts

Let's say I have a table with 500 rows - there is a column that divides it into equal sections of 50 rows (5 unique values for that column). I have a list of 50 tag values I need to apply to this table - it will be the same 50 tags for each of the 5 sections defined by that column. I guess I need to add rows 1, 51, 101, ... to the marked row list and then apply tag 1. Likewise for tag2 etc. How do I set up the loop so it is most efficient in reality the table size and the number of tags is much larger. I currently setup a loop over all rows one by one then I take the mod value of the row index with number of rows in tag list and then add that row to marked row, get the tag value using the mod index, apply the tag and then move to the next row. It is very slow.
Link to comment
Share on other sites

If you have 500 rows that are splitted by 5 unique values then each section should have have 100 rows, not 50. But that doesn't matter for now. Let's assume your table has the correct natural sort order when it is loaded. Then you could use a simple rank function to get your tags.

Here, ColX is the column with the 5 unique values that defines your sections



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...