Tuesday, April 17, 2018

Using Quotes in Filemaker Code: How to Allow Quotation Marks in Phrases and Prevent Interpretation As Code Operators

There are times when you want quotation marks to appear in a natural world phrase in English language (for example) or a code within code for output of a Filemaker function. However, when you put quotation marks in Filemaker code, the quotation marks are interpreted as the boundaries of the phrase.

If you want quotations to appear as part of the functioning code, you need to put a backslash in front of each quotation mark.

For example, suppose you want a Filemaker calucation to automatically construct HTML code with the following styling (you want to prevent the quotes from being interpreted as code operators) ...

YOU WANT OUTPUT ...
<span style="background-color: red; color: white; font-size: x-large;">&nbsp;<strong><em>RELATED NEWS …&nbsp;</em></strong></span>

CODE REQUIRED ...
"<span style=\"background-color: red; color: white; font-size: x-large;\">&nbsp;<strong><em>" & SAMPLEFILEMAKER::samplefilemakerfield & " …&nbsp;</em></strong></span>"

Note: The very first quote defines the beginning of a desired text phrase. The second quote, preceded by a backslash defines the quotation mark that is need in the HTML code for the desired output.

The third instance of a quotation mark also defines a quotation mark that is need in the HTML code for the desired output.

The fourth instance of a quotation mark defines the end of a FileMaker text phrase.

The ampersand joins the text phrase with a field output.

The fifth instance of a quotation mark defines the beginning of a second text phrase.

The sixth and final instance of a quotation mark defines the end of the second text phrase.

See also ...
community.filemaker.com/thread/129671