...
- The TEMPLATE$ function is the core function to create knowledge based scripts for other programs;
- The basic mechanism of the TEMPLATE$ function is a script including parameter names, which will be replaced with actual values during execution;
- Please note that, when no format tags are used (see hereafter), the Cell width specified in the the Slots & Properties will have influence on the placement of the parameter values;
- Furthermore, string values are aligned to the left and numeric values are aligned to the right by default;
- Although you can write the script directly between quote on the place of Template$, the easiest way is to use the TEXTITEM$() function to refer to a script in the data slot of the relation;
- Please make sure that, when you are using TEXTITEM$() you are using delimiters for the start and finish of the script that are different from other characters in your template!
- There are several ways to define where and how to place a parameter value:
- ~ParameterName, see also syntax;
- ~ObjectName(ParameterName1, , ~ParameterName or ~TeLiTabName(ParameterName1, , ~ParameterName, write the content of an object/TeLiTab (most probably a table) specified by the parameter names in their defined order. Useful for writing tables;
- ~ObjectName(ParameterName1\1) or ~ObjectName.ParameterName.1 or ~TeLiTabName.ParameterName.1, write the content of an object but only case 1 of ParameterName1. Useful for writing multi-case values. these values might have a single value but still are presented in the table of a TeLiTab (being a multi-value parameter~ParameterName;
- #ParameterName#, this method is useful for producing a flow of text and replacing parts in text. #ParameterName# is replaced without leading and trailing spaces. So please realise that "#Pi|F12.3#" (Pi using fixed format, a cell with of 12 and 3 decimal places) returns " 3.142" and is put in the text without spaces, thus as "3.142";
- #Boolean Expression[Label]#Text to be placed[Label], use an expression and place the text (or parameter) specified between the labels when the expression is true. Will not work with Objects in a Boolean Expression and functions referring to data in an any data slot;
- TEMPLATE$ makes it is also possible to generate FORTRAN-look alike formatted data, e.g. for programs requiring an input file containing a formatted set of values. In this case the parameters and their formats are providedwithout "~" or "#" but simply separated by comma's and/or spaces. This mode can be used in individual lines of Template$ when they ONLY contain these formats, so not mixed with other text. See the example below for more details
- Moreover, it is possible to place values in combination with expression (see an example below);
- Besides the replacement options, there are some options for defining formats. In general the format are defined by ParName|Format$. The formats defined in FORMAT$() can also be used for the TEMPLATE$() function (but with "|" behind the parameter name instead of between quotes).
- Note that using the format statements a picture connected to a parameter value can be shown (see also Image management, Data use and management and Documentation of knowledge ). Use <parametername>|P;
- Moreover, when @EQEXPLAIN is used, without the format statements, the actual value for a parameter is shown in the template. If you want to use the explanation as shown using @EQEXPLAIN use <parametername>|C;
- Please note that you can add a Carriage return Linefeed ( CrLf ) to values by adding "/|" after the format. Example: OWPOL OWPOL(NT|I18|X2|1)/| will write the first case of NT (indicated by |1) in object OWPOL as integer in a cell of 18 positions followed by two spaces (X2) and than place a Carriage return Linefeed
- Special addition that will only work in the TEMPLATE$ function:
- Adding &Number to the fixed format (F) will round values on multitude of Number. Example: "#Pi|F12.3&0.25#" returns " 3.25" and is put in the text without spaces, thus as "3.25"
- Integer values can also be printed as words using &English, however, only for 0-10 and in English. Example: "#NPROP|I2&English#" returns "One" for NPROP=1
In addtion to &English for returning "Value" you can use either:
...
{"serverDuration": 118, "requestCorrelationId": "31971517240988fb"}