Text Formula is a text string consisting of various elements such as
record field values, formulas, variables, system values, etc.
A Text Formula value is calculated directly before it is used. For
example, the following Text Formula:
Today: [$_Date], when exported into a text document will be replaced with:
Today: 2005-10-10 (if today is October 10, 2005).
Text Formulas can be used in the following cases:
- In Scripts, to set variables and text parameters (for example, message text or field value).
- In Custom Export Editor, for creating export templates; in fact, an export template is one big text formula.
- In Report Styles, to output specific text.
- Many other places. To find out if the text will be recognized as a formula, simply start typing the formula. If the tags [Tag Text]
are highlighted in blue, you can use elements of a text formula here:
For convenient editing of text formulas, the program features Text formula editor that can be accessed by clicking the "..." button on the right of the
field to be edited:
Note: starting from version 5.0 the text formula format was changed. The old format that uses the # symbol is supported but not recommended.
Text Formula Editor
You can edit text manually or use the buttons on the left to insert text formula elements quickly:
- Variables - allows inserting variables into the text.
In the text it looks as
follows: [$Variable Name], for example: [$total].
- Fields - allows inserting fields of record into the text. This button can be unavailable if you can't use a text formula for one record type.
In the text it looks as
follows: [Field Name], for example: [Name].
- Formula... - allows inserting a mathematical formula. Note: a formula is inserted into the text as ready-made, i.e., all text identifiers are replaced with the corresponding number IDs.
In the text is
looks as follows: [%Formula], for example: [%5+sin(f(14))].
- System Value... - allows inserting a system value into the text. The
systems values can be:
In the text it looks as follows: [$_Value Name], for example: [$_Date].
- Date - the current date;
- Time - the current time;
- User Name - the name of the user working with the database. This value should be used when several people are working with the database via network. The name of the user for the client corresponds to the name under which the user has connected to the database; the name of the user for the server is entered at the moment of sharing the database. To learn more, see the Network section.
- Database Path - a path to the current database, for example c:\databases\mydb.bbd;
- Cur Folder Name - the name of the current folder.
- User Input - is available only for text formulas used in rules.
Before checking the rule, the user is instructed to enter the values of the
parameters. The text inside the tag is used as the window caption.
In the text it looks as follows: [?Comment String], for
example: [?Enter date:];.
Sometimes we need to use some special characters like "[","]" in texts, and
the program attempts to interpret them as texts. If that's the case, use the
- Replace [ with :Unknown block: :
- REPLACE ] WITH ::
- Replace ; with :':
To set formatting for the data returned by the text formula elements, you have to add another ^ symbol and indicate the formatting string after it. For example (for variables):
- [Cost^math #0.00], output: 123.00 (2 digits after comma).
- [Name^text UCASE], output: THOMAS ANDERSON (all capitalized).
- [Birthday^date dd.mm.yy], output: 16.04.1983 (the date format).
To use the Formatting wizard, click a bracketed text formula element, then click the Set Format... button. To learn more, see the Formatting Data section.