Jump to content

using quotes in a calculation


This topic is 5706 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello all,

can someone tell me how i can use quotes such as --> "" in a calculation field, so i can actually display them in the output of the calculation?

for example try to make a calulation which contains

"pic.gif" and it will not quite work. there must be a special way to quote the special characters, but i cant make it cooperate.

thanks,

overrider

Link to comment
Share on other sites

In addition to escaping the quote mark with a backslash, there are a couple of other options: one is to use the Quote() function, which returns what's inside the parentheses with quote marks around it. This would work well for example if, in the img tag above, the URL part of the tag was in a field.

Another good option for you, since you have FM8 Advanced, is to make a custom function called QUOTE that takes no parameters and simply contains a quote mark. This makes it easy to use in your text calculations, and many developers swear by it. One advantage is it makes your code very easy to read, in case another developer ever has to work on your projects.

Link to comment
Share on other sites

  • 4 weeks later...

IMPORTANT: the Quote() function not only puts quotes around the expression, it also [color:red]escapes any special characters with a backslash ()! This may NOT return the results you're expecting, as I recently found out the hard way.

My file path Quote(diskfolderfile) turned into "diskfolderfile" -- thanks for the extra slashes, Quote function!

From the help file:

"This function protects text from being evaluated by the Evaluate function."

OK. So I'd now recommend only using Quote for that. Otherwise, the potential headache is not worth the small efficiency you gain.

Link to comment
Share on other sites

This topic is 5706 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.