Hello Everyone!
In a short makro, the replace () function command works perfectly fine to replace the comma of a number with dots:
{
“Name”: “test”,
“CreationDate”: “2021-9-22”,
“Commands”: [
{
“Command”: “executeScript_Sandbox”,
“Target”: “var s = “1,5”; return s;”,
“Value”: “profit”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “var mystring = ${profit}; var replaced = mystring.replace(/\,/g,’.’); return replaced”,
“Value”: “fprofit”,
“Description”: “”
}
]
}
It changes the variable profit from 1,5 to 1.5. It is tested and is working. I want to use this for a more complex makro to replace the comma in a currency text to a dot.
When I want to use this function in a long makro, to have a real use case, it gives me the following error:
- [error]
[Line 183]: Error in executeScript_Sandbox code: mystring.replace is not a function
Here is the part of the code that is relavant:
{
"Command": "executeScript_Sandbox",
"Target": "var mystring = ${profit}; var replaced = mystring.replace(/\\,/g,'.'); replaced=Number(replaced);return replaced;",
"Value": "fprofit",
"Description": ""
},
Does Anyone know what I did wrong to have the same command work in the short makro, but tell me that mystring.replace is not a function in the longer, relavant makro? What can I do to fix it?
Thank you!