How to get the particular item's cell index (item#) in RG or WF step

This is awesome.

In a table element that shows multiple items/rows of data across all users, I needed to reference specific item numbers from a DB search for a specific user in the table so I could perform various sequential calculations.

By doing a search of items equal to current row’s user and then using this trick to find the position, I was able to feed my formulas correctly regardless of what sorting/filters were present on my table.

I’m sure there are other ways to do this, but I spent days trying to figure this out and would probably still be doing trial and error without this trick.

1 Like

Just want to add that this is indeed brilliant and helped me greatly. Thanks @gs1

For anyone who is a dummy like me and not super versed in regex, you simply select extract with regex and paste in ,(?=.*?item_id )

But then in the regex expression, you need to use dynamic data to call out the item_id that you need. This part took me a second to realize and figure out how to do. Other than that, the instructions are pretty straight forward.

FWIW , for anyone not comfortable using regex, you can a do a similar thing without it.

Just join the array of IDs into a single string, split the string by the ID of the target item to get the items before it, then just count those (using spit by again), filtering out any empty values, and adding 1.

5 Likes

I just wanted to say a huge thank you @gs1 I spent 8 hours on this problem only to find this post & realise I should have been countin commas all along!

1 Like

DUDE! this is amazing. solved a huge problem for me. TY

1 Like

Thank you. Great solution, really appreciated.

this trick helped me a lot, thanks @gs1. i also figured out an alternative method to regex part, a bit longer but maybe helps someone:

list of things:formatted as text(each line > unique_id / separated by > comma):split by[target items uid]:first item:split by[comma]:count + 1

this works exactly like the original but with a different approach, what this does in short is, it splits the comma seperated list of uid’s with our target uid, and now we have two lists, first list has uid’s coming before our target uid, and we split them with commas, get the count and add one to get our target uid index