Escape sequence in set function

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)}

1 answer

This widget could not be displayed.

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)}
Chers,
Rui Rodrigues.

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

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

486 views 3 18
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you