This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||
|
4D v18
Managing expressions
|
Expression syntax | Type | Description |
$wp_title | Text | Title defined in wk title attribute |
$wp_author | Text | Author defined in wk author attribute |
$wp_subject | Text | Subject defined in wk subject attribute |
$wp_company | Text | Company defined in wk company attribute |
$wp_notes | Text | Notes defined in wk notes attribute |
$wp_dateCreation | Date | Date creation defined in wk date creation attribute |
$wp_dateModified | Date | Date modified defined in wk date modified attribute |
$wp_pageNumber | Longint | Page number as it is defined: from the document start (default) or from the section page start if it is defined by section page start. This expression is always dynamic, it is not affected by the ST FREEZE EXPRESSIONS command. |
$wp_pageCount | LongInt | Page count: total count of pages. This expression is always dynamic, it is not affected by the ST FREEZE EXPRESSIONS command. |
To insert an expression, make sure the cursor is located in the appropriate area (header, footer, or document body) and call the ST INSERT EXPRESSION command. For example, to insert the page number in the selected footer area:
ST INSERT EXPRESSION(*;"4DWPArea";"$wp_pageNumber")
The following document design can be defined, for example:
Table and field expressions inserted in 4D Write Pro documents support the virtual structure definition of the database. The virtual structure exposed to formulas is defined through SET FIELD TITLES(...;*) and SET TABLE TITLES(...;*) commands.
When a virtual structure is defined, references to expressions containing fields display virtual names when the 4D Write Pro document shows references and not values. Commands that handle references expect and use virtual or real names according to the following table:
Command | Virtual structure support |
WP Get text | Returns virtual structure names if wk expressions as source option is set in expressions parameter. |
ST Get plain text | Returns virtual structure names if ST 4D Expressions as sources option is set in refMode parameter. |
ST Get expression | Ignores virtual structure. Always returns real table/field names |
ST INSERT EXPRESSION | Ignores virtual structure. Always expects real table/field names |
Note: When a document is displayed in "display expressions" mode, references to tables or fields that do not belong to the virtual structure are displayed with "?" characters, for example [VirtualTableName]? when the field is not defined in the virtual structure.
Download HDI database
Using commands from the Styled Text theme
Product: 4D
Theme: Managing expressions
Created: 4D v16
Modified: 4D v17 R4
4D Write Pro Reference ( 4D v18)