7.3. Legacy format strings #

7.3.1. Format string for strings
7.3.2. Format string for numeric values
7.3.3. Format string for datetime values

Legacy format strings are like in C, but not always identical.

7.3.1. Format string for strings #

To print a string, the %s format string can be used. Examples for using it in the Text element format attribute can be found in the Format attribute examples.

Example expressions for the format() function:

format(query1.field1, '%s')
format(query1.field1, 'Look, there is a %s there!')

Example expressions for printf function:

printf('%s, 'query1.field1')
printf('Look, there is a %s there!', query1.field1)

Supplementary format string flags are supported. See the string flags in printf(3)

7.3.2. Format string for numeric values #

To print a number, the %d format string can be used. As opposed to the C printf format specifier where %d is used for integers, this is used for printing fractions, too. Examples for using it in the Text element format attribute can be found in the Format attribute examples.

The same format string can be used for the the format() function and the printf function, just like in the previous examples for strings.

Supplementary format string flags are supported. See the decimal and float/double format flags in printf(3)

7.3.3. Format string for datetime values #

RLIB approximated strftime() when printing a datetime value. OpenCReports uses strftime(). See the strftime() function description for the complete description of format string flags.

When a datetime field didn't have an explicit format string, RLIB used the US date format to print the datetime value. On the other hand, OpenCReports uses the locale specific date format if the report has a locale set.