In addition to the rules that are used in decisions, rules can also be used to visualize the current validity state of features and objects in the knowledge base.
For example, a color of the lampshade in our tutorial might be invalid under certain circumstances. To provide a realistic example, another production site feature is created in the Products class and another control is created on the form for this feature.
Now a scenario could be that the particular color red of the lampshade is not to be manufactured in Stuttgart. In this case, we decide to ban the color red at production site = Stuttgart.
The color of the lampshade is stored in the Sigma Lamp Shade class, but the feature [Production site] is in the Products class. So first we store an object reference in the class Sigma that there might be (is) a father object of class type Products for Sigma Component classes.
In order to store validity rules on a feature, it must be marked for it.
Among the properties of the Color feature in the Sigma Light Shade class, you will find the Rules switch. Please turn it on:
Now you can create the following rule by clicking the possible value red and creating an Allowing rule.
The rule states that the color red is always valid (the green check mark at the possible value) and is prohibited in the case of the production site Stuttgart.
To make these rule results visible to the user, we need to turn on the visibility of validation symbols on the associated control:
(Set initial value of ValidationSymbol True)
If necessary, you can also turn on the validation symbolism at the corresponding tab of the register. For tabs, the peculiarity is that they check the control variables of controls embedded on the tab, and change state when invalidity occurs.
The result of your modification should look something like this:
Now, when you click the validation icon of the color, an info window appears (depending on the control's ValidationAction property):
First of all, you will notice, the text is displayed in German. This is, because the computer running this tutorial is a German system.
If you change the locale of the server, the text can be displayed in English.
Server.Locale := 1033
Client.Locale := 1033
The locale of the German language is in fact 1031.
Server.Locale := 1031
Client.Locale := 1031
Output with locale 1033
The text of the info window is automatically compiled and does not always provide sufficient and readable information. The text can therefore be customized:
- the text of the value
Automatic text generation outputs the value of the possible value. If you want to output your own text instead of this value, specify it for Explanatory text.
- the text of the rule
If you want to specify a different text instead of the automatically generated rule text, you can assign a text to the rule under Rule explanation.
(knowledge base Tutorial Stage 8)