Hi all - I need to get the index of a dropdown selection, and based on existing forum searches have tried the following two approaches, but neither are working - would LOVE any advice, thank you!
The list of options is Current User's custom_status_labels_1
And the dropdown selection is Dropdown Custom1's value
Approach 1: Toolbox JS tools
Using Toolbox, just add an Expression element to do the search, as follows:
Unfortunately, this returns a blank. Note the element is visible on page load
Approach 2: 1T - Index Finder plugin
I also tried using the 1T-Index Finder plugin, but when I add a FindIndex element, there are no options:
Dropdown’s choices (the search expression used to fill the drop-down options):each item’s unique ID
This produces a comma separated list of the unique IDs of the drop-down list.
Then, to the arbitrary text:
extract with Regex:
,(?=.*?unique ID of the selected value)
And after the extract with Regex:
:count + 1
Essentially, this counts the number of commas before the relevant unique ID in the arbitrary text, which gives you the index of the unique ID.
Your final expression will look like:
Arbitrary text:extract with regex:count + 1
Edit: if you’re using an option set, you can just use the Display of the option set instead of the unique ID (but be sure to remove any commas/conflicting characters in the Display)
Oh, it’s just a list of texts? Okay, then do the same method but instead of unique IDs in the arbitrary text just put each item (e.g Current User’s custom status labels). A list of texts by default will be formatted as a CSV list.
Same goes for the regex expression, replace the unique ID with the Dropdown’s value.
Thanks @georgecollier ! I’m not as familiar with JS, so I’m struggling to figure out the syntax properly, could you give me a sense of what that would look like? Thank you so much!