Expand my Community achievements bar.

SOLVED

How to isolate a specific url parameter from my query string

Avatar

Level 3

Hi, 
In the mapping of my datastream, I want to isolate the value of a specific url parameter.
Example: from "test=1&account=bitmap&step=abc", I want to map as output the value of account, so 'bitmap' in this case.

 

I did it this way based on this doc and it works:

robinl39529461_0-1734096834481.png

 

But I have also unwished value if the parameter contains 'account=', not only equals 'account='

Example:

robinl39529461_1-1734096973839.png

Output should be null because the parameter name is 'IDaccount=' and not 'account='.

Any idea how I can fix this ?

Thanks

 

Robin

 



1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi @robinl39529461 ,

You should be able to achieve this by nesting get_url_query_str and map_get_values functions like below,

map_get_values(get_url_query_str("https://example.com?test=1&account=bitmap&step=abc","retain"),"account")

Here are the results for two strings you tested,

Harveer_SinghGi1_2-1734536575294.png

Harveer_SinghGi1_4-1734536636743.png

 

 

 

View solution in original post

2 Replies

Avatar

Correct answer by
Level 4

Hi @robinl39529461 ,

You should be able to achieve this by nesting get_url_query_str and map_get_values functions like below,

map_get_values(get_url_query_str("https://example.com?test=1&account=bitmap&step=abc","retain"),"account")

Here are the results for two strings you tested,

Harveer_SinghGi1_2-1734536575294.png

Harveer_SinghGi1_4-1734536636743.png

 

 

 

Thanks a lot for your help. 
It works. Id did it this way using your logic: 
get_url_query_str(get_url_decoded("https://example.com?test=1&account=bitmap&step=abc"),"append")["account"]

Thanks again

 

Robin