Extracting a URL path parameter #33
-
Is there a better way to get a path parameter from a URL in a dataflow than using a String Splitter and Array Indexer with a fixed index? If not, what's the cleanest way to have that fixed index be relative to the end of the list rather than the start? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
A couple possible approaches to indexing from the end:
Not sure if either of those seems better than the other or if there's another option I'm overlooking. |
Beta Was this translation helpful? Give feedback.
-
I would suggest using a Uri Parser rather than a String Splitter for finding the URL path components. Either of the indexing approaches you've outlined sound reasonable; I personally prefer option 1 since it's more concise by one module (or two; if you're lucky enough to be passing the output into a collection, you can slice down to a length-one array and skip the indexer), but option 2 might be more legible. |
Beta Was this translation helpful? Give feedback.
I would suggest using a Uri Parser rather than a String Splitter for finding the URL path components. Either of the indexing approaches you've outlined sound reasonable; I personally prefer option 1 since it's more concise by one module (or two; if you're lucky enough to be passing the output into a collection, you can slice down to a length-one array and skip the indexer), but option 2 might be more legible.