Literal Constants

QLingo supports constant literal values of the following types:

String literals

String Literals are used to write strings of text.

Syntax:

A string literal is enclosed in double or single quotes. A string may include both types of quotes. If you have both types of quotes, you need to escape the enclosing quote by preceding it with a backslash.

The actual backslash is ignored, as shown below:

\' is '

\" is "

\t is tab

\n or \r are used as line feeds (media dependent). For example, for html the line feed is <br>, therefore \n and \r will not take effect. This holds true unless the rule is defined for html production.

\\ is \

\b is b, and so on

Examples:

The following examples show the escape sequence in the strings:

"Joan's Car"—Joan's Car

'Joan\'s Car'—Joan's Car

'\Joan'—Joan

"Joan\nSmith"—Joan
 Smith

"Joan\tSmith"—Joan   Smith

"text starts with \"Hello …\""—text starts with "Hello …"

'text starts with "Hello …"'—text starts with "Hello …"

"\\Joan\\" - \Joan\

Number literals

Number literals are used to write text that includes numbers.

Syntax:

A number literal can be optionally preceded by a positive or negative sign and can include a decimal point.

Examples:

123

+201

-2

1.34

-1898.22214

Date literals

Date literals are used to include dates according to specified formats.

Syntax:

A date literal is enclosed in pound signs (#). The currently supported date formats are #dd/mm/yyyy# and #dd/mm/yy#. You can use QLingo’s 'FormatDate' function to format dates in a different way.

The use of the following delimiters is also supported: '\','/','-' and '.'.

Single digit numbers must have a preceding zero.

Examples:

#02/03/2001#

#14\06\92#

#02-03-2001#

#14.06.92#

Boolean and null constants

Boolean constants can be used in logical expressions. There are two built-in logical constants: TRUE and FALSE.

Null is a built-in constant that represents the null value (the database concept of an undefined value).

Null also represents a non-existent value. For example, if a query returns one row, and references a value in a second row that does not exist, the result is null. Additionally, in the case where you have an If statement that does not contain ‘else', if the condition is not met, the expression value is Null.

Note that the Null value as an end result of a content object is treated as an empty string.

Syntax:

Null constants can be used in comparisons with the Equality (==) or Non-Equality (!=) tests.

Examples:

[MyRecordset][0].[Name] != NULL

@{startDate} == null