Restrict the value range for references
For object class properties of the type Reference or Reference Array the Type Info attribute of the object class property in the class model defines which object classes can be the reference target.
In Alfabet Expand, you can view the setting in the Meta-Model tab. Expand Classes > the relevant object class > Properties and click the relevant object class property. You can see the Type Info attribute setting in the attribute window. The Type Info attribute is not editable in the standard object class model.
You can further restrict the specified reference targets with one of the following methods:
- Limit reference targets to objects of a specific object class or object class stereotype. If object class stereotypes are defined for a target object class you can define that the reference should only target a subset of the available object class stereotypes. If the reference can target multiple object classes, you can exclude some of these object classes as possible target for the reference.
- Limit reference targets to objects returned by a query. If you want to restrict the objects a user can select as reference target to a range of objects for which specific conditions apply, you can define a query returning the objects a user shall select from when setting the reference. This setting is only available for protected and custom object class properties.
If you define both restrictions for an object class property, the user can only select objects to which both rules apply.
If you define a range restriction for an object class property already in use, already available settings not matching the restriction will persist in the database until a user manually changes them to an allowed value.
If the Back Reference attribute of the object class property establishing a reference shows the name of an attribute of the target object class, the target object class also stores the reference in the defined object class property. For example, if an application is assigned to an application group, this is stored both in the object class property Applications of the application group and the object class property ApplicationGroups of the application. If you restrict the range of the reference, you need to configure the target object class as well. For example, if you limit the Applications object class property of the object class ApplicationGroup to applications of one of five application stereotypes only, you must hide the object class property ApplicationGroup from the other four object class stereotypes of the object class Application.
You have defined class settings for the object class. Whether your settings are used as default or for users logged in with defined user profiles only depends on the definition of the class settings for which you are configuring the object class properties
- Go to the Presentation tab.
- In the explorer, expand the nodes Class Settings > the object class (stereotype) you would like to edit > the class settings you would like to edit.
- Right-click the Properties node and select Modify Property Behavior.
- The new property modification will be added as the last child node of the Properties node with a random property assignment. Click the node and select the relevant object class property in the Property Name attribute.
Each object class property can only be added once to the Properties node. If you do not find the object class property in the drop-down list, there will be already a modification for this property. Change the existing property modification node.
- Open the editor of the Value Range Definition > Limit to Classes or Stereotypes attribute, select the checkmark of all object classes or object class stereotypes that you want to allow as reference target and click OK.
- Optionally, change the caption, hint and availability on the user interface for the object class property to match your reference target selection.
If the Back Reference attribute of the object class property establishing a reference shows the name of an attribute of the target object class, the target object class also stores the reference in the defined object class property. For example, if an application is assigned to an application group, this is stored both in the object class property Applications of the application group and the object class property ApplicationGroups of the application. If you restrict the range of the reference, you need to configure the target object class as well. For example, if you limit the Applications object class property of the ApplicationGroup object class to a defined range of applications only, you should hide the object class property ApplicationGroup for the Application object class.
The restrictions will only be applied to data workbenches, property groups in data workbenches, and guided data entry views. If you have migrated from an Alfabet 10.15.x release, you need to additionally configure the restriction in your editors and wizards with the methods valid for editors and wizards.
You have defined class settings for the object class. Whether your settings are used as default or for users logged in with defined user profiles only depends on the definition of the class settings for which you are configuring the object class properties
- Go to the Presentation tab.
- In the explorer, expand the nodes Class Settings > the object class (stereotype) you would like to edit > the class settings you would like to edit.
- Right-click the Properties node and select Modify Property Behavior.
- The new property modification will be added as the last child node of the Properties node with a random property assignment. Click the node and select the relevant object class property in the Property Name attribute.
Each object class property can only be added once to the Properties node. If you do not find the object class property in the drop-down list, there will be already a modification for this property. Change the existing property modification node.
-
Open the editor of the Value Range Definition > Range As SQL Query attribute or the Value Range Definition > Range As Alfabet Query and define either a native SQL query or Alfabet query according to the following rules:
- The query must return objects of a target object class defined in the Type Info attribute of the object class property:
- If you define an Alfabet query, the FIND class must be the target object class.
- If you define a native SQL query, the first column defined in the SELECT statement must return the values of the REFSTR object class property of the target object class.
- You can use Alfabet query parameters except the BASE parameter and parameters related to specific context, like wizard or workflow related parameters.
- The information displayed in the selector on the user interface is not taken over from the query. The Image Properties defined in the class settings are used and sorting is done in alphanumeric order.
- If an enumeration is assigned to the object class property in the Enumeration attribute, you can only further restrict the range to a subset of the strings defined in the enumeration. If the query defines values outside the enumeration scope, these values are ignored. The order of strings in the query supersedes the order of strings in the enumeration.
- The query must return objects of a target object class defined in the Type Info attribute of the object class property:
- Optionally, change the caption, hint and availability on the user interface for the object class property to match your reference target selection.