We now want to prepare the list of the material used to a print result.
In the first step, we define a freely selectable name for a print result in the properties of the knowledge base.
A print result is generated in TCE, in which one or more text templates are created in each object and they are merged into an overall result.
Let's look at the desired overall result:
The result consists of a header area with the heading text and heading description of the table, a table in which each material represents a row, and the sum of all position prices.
So, we create a text component in the Material class that represents a line of print: Under the constants of the class, we define a constant group [Print templates] and below it a constant of type RTF (Rich Text Format) with the name [Material list].
We fill in the constant [Material list] with the following contents:
Because we want to print in all dialog languages, the RTF constant must me multilingual.
You can see some grey-covered texts with curly braces. These are created via the menu item InsertàDocument variable. The text within the curly brackets is an expression whose value is entered here when the result is generated. You define the top area with title and header description in the header of the text.
Now this text module must be defined as part of our result: If you click the structure tree item Results in the Material class, you will see two terms generated from our result name:
Material list_Before is a result component that is passed through before the result generation of possible child objects. Material list_After accordingly after the result components of the child objects have been passed through.
Since our material objects do not have any child objects, it does not matter what result you use. However, we recommend the use of _Before. Double-click the result and it will be created under Results.
Now you create a result component under the result Material list_Before. Select the RTF constant
[Print templates].[Material list]
If necessary, you can use rules to determine when to use this result component. Here the result component is always allowed, so it is always used.
Next, a text module is also created in the Start class:
Think of the multilingualism of the RTF constant.
Now a result with result component is created analogously to the class material, but here necessarily Material list_After in the result, because this text is to be generated only after the processing of the child objects.
Results are generated using the TCE Function Results. This function returns the generated result as an RTF variable.
So, we create a feature with the name PrintOut of type RTF in the Start class to record the result, and in the main menu a new entry to get the result, and a window to display the result.
In the Click event for the printing of the result use:
PrintOut := Results("Material list")
(knowledge base Tutorial Stage 13)