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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Tuesday in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

108 views 0 2
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