cancel
Showing results for 
Search instead for 
Did you mean: 

High-Level Overview of How to Modify Input Key Data in Automation Pilot

Ron_Hagan
Product and Topic Expert
Product and Topic Expert
178

I have an input key that asks for a period (month and year) and would like to modify whatever the user enters so that it replaces the space between the month and year with %20 to use it as a parameter in the GET URL.

I'm just looking for general ideas on how to accomplish this.  Any ideas and/or suggestions are gratefully requested.

Thanks!

Ron

View Entire Topic
0 Kudos

Hello Ron,

You can achieve this with the usage of expressions. There are three approaches you can take:

1. Using the `toUrlEncoded` function like so: `$(.execution.input.text | toUrlEncoded)`. It will encode all special characters and is designed to be used in URLs.
2. Using the `toPercentEncoded` function: `$(.execution.input.text | toPercentEncoded)`. It is similar to the previous one, but replaces whitespace characters with %20 as in your request.
3. Alternatively, you can use the `sub/gsub` functions: `$(.execution.input.text | gsub("\s+"; "%20"))`. It will only replace whitespace characters with %20 without encoding the rest of the special characters like /, : etc.

Additionally, you can draw inspiration for the available functions (those we keep updated in the docu) from here.

Hope this helps. Let me know if you have any more questions.

Best regards,
Kostadin