TestProject Forum

SQL Query is fetching correct results but with some extra curly brackets and double quotes

Hello,

I am running an SQL Query in MSSQL and storing that result in a parameter. When I see the parameter value, there are some extra things like curly brackets, double quotes and a colon, which are getting stored in the parameter, due to which TestProject is unable to find that element. I just need the number in the parameter to successfully run my test. Here is the screenshot attached for how the parameter value looks like. Also attaching the screenshot for the SQL Query run result.


image

Thanks,
Ritika

Hello @rsood, thanks for reaching out.

there are many actions you can use for manipulating strings, provided by the “String Utils” addon:

image

such as:
Replace substrings, Get substring in range, Get the string length, etc’

for your specific case, the most efficient way will be using the “Replace substring with regex” action:

The action will replace all occurrences matching regex [{}":] in {"":“d669afeb-c247-11ea-810a-005056837fec-5980”} with an empty string,
the output will be: d669afeb-c247-11ea-810a-005056837fec-5980 which you can store in a parameter for further use.

Hello @rsood
Which output parameter have you used?
There are two, one which holds the value as JSON and one which returns the output only.

Hello @meidan.nasi, thank you so much for your suggestions. “Replace substring with regex” worked in this scenario.

Thanks,
Ritika

1 Like

Hello @ran.tzur, I am using the one which returns the output. I tried using the other one which holds the JSON value but that was not working. Thanks for asking. Finally the “Replace substrings with Regex” worked in this scenario.

Thanks,
Ritika