|
Top Previous Next |
Variables All variables and commands can be identified by \ (backslash) symbol in the beginning and in the end. In example below you can see \CLIENT_NAME\, \CLIENT_STREET1\ and \CLIENT_PHONE1\ variables: To: \CLIENT_NAME\ Address: \CLIENT_STREET1\ Phone: \CLIENT_PHONE1\ When you use this template by clicking on Save or Print in some dialog box, \CLIENT_NAME\ variable will be replaced by name of currently selected client, \CLIENT_STREET1\ — by client’s street address and \CLIENT_PHONE1\ — by client’s phone number. The final output will look like this: To: XYZ Company Address: Elm Street, 1 Phone: +1 212 898 11 31
Job Total: \fnum(dtLinkJobs:TOTAL, 2)\
Data Scan commands Another of RTF templates is Data Scan commands. These are used to create tables in which number of rows is determined by the number of records in database.
1. Begin by entering \scan(dtLinkJobs)\ command. This must not necessarily be dtLinkJobs, depending on the template, this can be:
2. Insert table header between \scan(dtLinkJobs)\ and \scanentry\. 3. Insert one row of data-columns after \scanentry\. Every variable in table must be preceeded with dtlink commfnd. For instance if the table begins with \scan(dtLinkJobs)\, each variable must have this link included: \dtLinkJobs:JOB_NAME\, \dtLinkJobs:COMPLETED\, and so on. 4. Insert \endscan\ after data-columns.
Example: Command \scan(dtLinkJobs)\ will make the parser scan (go from first record to the last one) all selected data in Jobs table (in this particular case all jobs included in the invoice) and output them to file or printer. Text between \scan(dtLinkJobs)\ command and \scanentry\ command is table header. Text between \scanfooter\ and \endscan\ commands will be considered table footer and will only be displayed once at the end of this table. Text between \scanentry\ and \scanfooter\ commands is table "body". It includes variables from columns which must be listed in the table. In example above these are:
Condition checking This allows the template to react to certain varying conditions and produce output suitable to each of possible conditions. The logic is the following \IF(condition)\ Reaction \ENDIF\. Example: If Discount 1 is applied, display discount name, discount value and subtotal. The code is as follows:
This will make the template check if discount 1 is applied, and if so — display data between \IF(...)\ and \ENDIF\ commands.
|