Thanks for your patience. You can use the "indexOf" function in combination with the "replace" function to achieve your scenario. Here's an example condition you can use:
if (ctx.name && ctx.name.indexOf('%20') !== -1) {
ctx.name = ctx.name.replace('%20', ' ');
}
This condition first checks if the 'name' property exists and contains '%20' by using the "indexOf" function. If '%20' is found, it is replaced with a space using the "replace" function.
You can include this code in a conditional skill definition to process the 'name' property of your input documents. Here's an example skill definition that uses this condition:
{
"name": "replace-space",
"description": "Replace '%20' with space in name property",
"context": "/document",
"inputs": [
{
"name": "name",
"source": "/document/name"
}
],
"outputs": [
{
"name": "name",
"targetName": "name"
}
],
"condition": "if (ctx.name && ctx.name.indexOf('%20') !== -1) { ctx.name = ctx.name.replace('%20', ' '); }"
}
In this skill definition, the 'name' property of the input document is mapped to the 'name' input of the skill. The condition is used to replace '%20' with a space in the 'name' property, and the resulting value is mapped back to the 'name' property of the output document.
Note that the condition uses JavaScript syntax and can be customized based on your specific requirements.
Hope that helps
-Grace