From a webpage response, we are extracting all occurrences of the data.
example: {id:1,ref:001},{id:2,ref:002},{id:3,ref:003}
Now, we have to post the all occurrences but modified (+A) as below :
{id:1,ref:A001},{id:2,ref:A002},{id:3,ref:A003}
How to modify all occurrence of the extracted variable?
Another way to do that is to split the value and join it again with that function:
function decode(encodedValue) {
var decodedValue = encodedValue.split("ref:").join("ref:A");
//Apply decoding logic here.
//JS Libraries can be used
return decodedValue;
}
In the variable extractor panel you have an option called "Value is encoded". If you choose the custom item in the drop down list you can edit a Javascript in order to modify your extracted value on the fly.
I guess in your case you can use a replace method to automatically replace all your ref: by ref:A strings.
Example:
function decode(encodedValue) {
var decodedValue = encodedValue.replace(/ref:/g, "ref:A");
//Apply decoding logic here.
//JS Libraries can be used
return decodedValue;
}