Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 4

...

  1. The TEMPLATE$ function is the core function to create knowledge based scripts for other programs;
  2. The basic mechanism of the TEMPLATE$ function is a script including parameter names, which will be replaced with actual values during execution;
  3. 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;
  4. Furthermore, string values are aligned to the left and numeric values are aligned to the right by default;
  5. Although you can write the script directly between quote on the place of Template$, the easiest way is to use the TEXTITEM$the TEXTITEM$() function to refer to a script in the data slot of the relation;
  6. Please make sure that, when you are using TEXTITEM$using TEXTITEM$(), you are using delimiters for the start and finish of the script that are different from other characters in your template!
  7. There are several ways to define where and how to place a parameter value:
    1. ~ParameterName, see also syntax;
    2. ~ObjectName(ParameterName1, ParameterName2, ...) or ~TeLiTabName(ParameterName1, ParameterName2, ...), write the content of an object/TeLiTab (most probably a table) specified by the parameter names in their defined order. Useful for writing tables;
    3. ~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...);
    4. #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";
    5. #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;
  8. 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
  9. Moreover, it is possible to place values in combination with expression (see an example below);
  10. 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).
  11. 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;
  12. 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;
  13. Please note that you can add a Carriage return Linefeed ( CrLf ) to values by adding "/|" after the format. Example: 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
  14. Special addition that will only work in the TEMPLATE$ function:
    1. 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"
    2. 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:

...