When a value is embedded in the formula itself it is called a constant.

Numeric Constants

A numeric constant may be in fixed point format, like the numbers in this example (2, 90 and 0.0625).

x+2
today() - 90
Total * 0.0625

A numeric constant may also be in floating point format, which consists of the mantissa followed by the letter e followed by the exponent. For example, suppose you needed to use this mathematical formula:

Here is how you would write this formula in Panorama.

x * 6.02e23

Text Constants

A formula may also contain text constants. A text constant 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 (usually referred to as a syntax 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, as shown in the example below. 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.

Built in Constants: Pi, Carriage Return and Tab

Panorama has one built in numeric constant—pi. Use the Greek π symbol to access this value. For example the area of a circle can be calculated with this formula.

π * radius^2

To create the π symbol press Option-P.

You can also use the pi() function instead of this special symbol.

pi() * radius^2

Panorama has two built in text constants—¶ (Carriage Return) and¬ (Tab). For example a three-line address can be included in a formula like this.

"Suzette Elliot"+¶+892 Melody Lane"+¶+"Fullerton, CA 92831"

To create the ¶ symbol press Option–7. To create the ¬ symbol press Option-L.

Panorama also has functions to create special characters:

cr() ☞ Carriage Return
lf() ☞ Line Feed
crlf() ☞ Carriage Return + Line Feed
tab() ☞ Tab
vtab() ☞ Vertical Tab

There is also a general purpose function, chr(, that can be used to specify any Unicode character by its numeric value (see Characters and Unicode Values).

Backslash Escape Sequences — Some programming languages allow you to embed special characters in a text constant by using a special sequence starting with a backslash character. Panorama doesn’t allow this, the backslash is just another ordinary character. For example, in the C programming language you can embed a tab character with \t, like this:

"First column\tSecond column"

In Panorama, you can’t embed a tab this way. Instead, you need to do something like this:

"First column"+tab()+"Second column"

Or like this:

"First column"+¬+"Second column"

See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0