Hi,
how do I escape characters in the set function?
E.g. I would like to store a complete javascript function in a variable and then call it later in the template. But as soon as I use "{" in the variable, the script won't work.
Is there an escape sequence for special characters?
This works:
${set(myFunction,"v=2*w;v.toString()")} %{var w=4;${myFunction}}
This doesn't work:
${set(myFunction,"function retVal(w){var v=2*w;return v.toString()}"} %{${myFunction} var w=4;retVal(w)}
Hi @Waldemar Friesen,
A ")" is missing on myFunction definition.
Try this:
${set(myFunction,"function retVal(w){var v=2*w;return v.toString()}")} %{${myFunction} var w=4;retVal(w)}
Hi @Rui Rodrigues,
thanks for the quick reply. Sorry for the misspelling. In my test environment the syntax was correct. I tried to copy the code into the comment field, but it always tried to open a new page instead of pasting it into the field... So I had to write it manually and forgot the closing bracket.
This means: It still does not work. As soon as you type an "{" in your variable value, xporter breaks processing.
Simple example:
Line to process: "String without brackets" ${set(varWithoutBrackets,"String without brackets")} Print out from Variable: ${varWithoutBrackets}
Line to process: "String {with} brackets" ${set(varWithBrackets,"String {with} brackets")} Print out from Variable: ${varWithBrackets}
Result:
error.PNG
I think this is a bug. Either there should be an escape sequence for special characters or xporter should not try to evaluate variable values.
Regards,
Waldemar Friesen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.