A text constant (see Constants) is a series of characters surrounded by quotes. When writing a text constant you may choose from six different types of quotes: Double Quotes, Single Quotes, Curly Braces, Smart Double Quotes, Smart Single Quotes, and Pipes.
Double Quotes — This is the most common quoting method. The embedded text begins with a "
and ends with another "
.
"January"
A possible complication is if you want to include the "
character itself in the embedded text.
Suppose that you needed to use the text The shim was 6" high in a formula. Using double quotes around the constant will cause a grammar error, because Panorama will think that the embedded text ends after the second "
character, and it won’t know what to do with the text high"
.
"The shim was 6" high"
One solution is put two double quotes in a row . Panorama will convert these into a single quote and continue with the text constant.
"The shim was 6"" high"
Another solution is to use a different type of quote (see below).
Some other programming languages solve this problem by using an escape character, usually a backslash. Panorama does not use escape characters in text constants.
Single Quote — The embedded text begins with a '
and ends with another '
, like this.
'Tuesday'
You can use single quotes if you want to include a double quote in the embedded text.
'The shim was 6" high'
Curly Brace — The embedded text begins with a {
and ends with }
, like this.
{San Francisco}
Smart Double Quote — The embedded text begins with a “
and ends with ”
, like this.
“Gothic”
Smart Single Quote — The embedded text begins with a ‘
and ends with ’
, like this.
‘Bohemian’
Pipes — The embedded text begins with one or more pipe symbols |
and ends with the same number of pipe symbols. For example, if the constant begins with |||
then it must end with |||
, if it begins with |||||
it must end with |||||
. Using the multiple pipes as quotes makes it easy to embed any other kind of character in the text constant:
|||last="Elliot" first="Suzette" address="892 Melody Lane"|||
You can even embed pipes within a piped constant, like this:
|||| language=javascript code=||alert("Hello World");|| ||||
As you can see pipe delimited constants are very handy for creating text constants that contain computer code.
See Also
- Arithmetic Formulas -- mathematical operators and functions.
- Characters and Unicode Values -- working with individual characters of text.
- Constants -- values embedded into a formula.
- convertvariablestoconstants -- converts all of the variables in a formula into constant values.
- Date Arithmetic Formulas -- performing calculations on dates, and converting between dates and text.
- Formula Workshop -- formula workshop wizard for testing and experimenting with formulas.
- formulacalc -- allows you to evaluate a formula that you were not able to
code into the procedure when it was being written.
- formulafields( -- returns a list of fields used in a formula.
- formulaidentfiers( -- returns a list of identifiers (fields and variables) used in a formula.
- Formulas -- basics of formulas: components and grammar.
- formulavalue -- calculates the result of a formula. Usually this is done with an assignment statement (for example `x=2 * y` ), but the *formulavalue* statement gives you more flexibility. You can specify what database is to be used for the calculation (an assignment statement always uses the current database) and you can specify the formula using a variable, making it easy to change on the fly. This statement also gives you more control over how errors are handled.
- formulavariables( -- returns a list of variables used in a formula.
- Functions -- index of all functions available for use in Panorama formulas.
- Linking with Another Database -- techniques for relating multiple database files so that they work together.
- makemergeformula( -- builds a formula from an “auto-wrap" style merge template.
- Non Decimal Numbers -- working with numbers in alternative (non-decimal) bases, including binary, octal and hexadecimal.
- Numbers -- Working with numeric values in a formula, and converting between numbers and text.
- Operators -- index of all operators available for use in Panorama formulas.
- Recompiling Code -- recompiling code & formulas
- Statements -- index of all statements available for use in Panorama procedures.
- SuperDates -- date and time combined into a single value.
- Tag Parsing -- Panorama functions for working with text that contains data delimited by tags, including HTML.
- Text Formulas -- manipulating text with a formula (concatenation, extraction, rearranging, etc.)
- Time Arithmetic Formulas -- performing calculations on times, and converting between times and text.
- True/False Formulas -- logical boolean calculations.
- Using Fields in a Formula -- accessing database fields within a formula.
- Values -- the raw material that formulas work with -- numbers and text.
- Variables -- storing and retrieving individual items of data, not part of a database.
History
10.0 | No Change | Carried over from Panorama 6.0 |