Create calculated properties

Calculated object class properties are defined with a query which generates a property value automatically. The query is executed whenever a user accesses a view displaying the calculated property. From a user perspective, calculated properties are handled identical to any ReadOnly object class property. They can be displayed in graphics, data workbenches and content areas to inform the user about important data about the objects of an object class.

The functionality provided by calculated properties is similar to the one provided by calculated indicators. Calculated properties offer additional advantages. They can be used to calculate values which are not related to evaluation and can return a date or a string. In addition, they provide reliable display of up-to-date values without users having to trigger update via a button interaction. Indicators shall be used instead of calculated object class properties if the use case is evaluation or if the query required to calculate the result is complex. Only simple queries can be defined for calculated object class properties for performance reasons.

Technically, the definition of a calculated property defines a database view which is updated with current values at runtime.

  1. In Alfabet Expand, go to the Meta-Model tab.
  2. Expand the node of the object class.
  3. Right-click the Calculated Properties node and select Create New Calculated Property.
  4. Define the technical name of the object class property in the Property Name field. Click in the Partial Technical Name field to define the part of the database view name which is variable. The name of the database view is:

    NameOfObjectClass_PartialTechnicalName

  5. Click OK.
  6. Set the attributes:
    • Caption: Define a caption for display on the Alfabet user interface.
    • Property Type:
    • Property Type: Select the value type of the calculated object class property. Depending on the object class property type, other attributes become available to provide additional settings for the value type:
      • Size: For String properties, define the maximum allowed number of characters.
      • Precision: For Real properties, define the maximum allowed number of decimals.
      • Enumeration: For Integer properties, optionally assign an integer enumeration to display a string instead of the integer on the user interface.
      • Type Info: For Reference properties, define the object class the reference targets. Open an editor for an attribute , set the checkmark of either Semantic Classes to select a private or protected object class or Public Classes to select a custom object class. You can then select the object class from the drop-down list of the selector on top of the editor. You can repeat these steps to allow multiple object classes as reference target.
    • Calculation SQL Query: Define a native SQL query returning objects of the object class the calculated object class property is defined for. The returned dataset must consist of two columns in the given order and definition:
      • The first column must be called REFSTR and must return the REFSTR object class property.
      • The second column must be called VALUE and must return the calculated value in the data type defined with the Property Type attribute.
      • You cannot use Alfabet parameters in the query.
      • You cannot use Alfabet instructions in the query.
    • Access in User Interface: Define whether the calculated property shall be available by default on the user interface. To hide the calculated property by default, select NoAccess . To show the calculated property, select ReadAccess. This value can be overwritten in the class settings.
    • Property Group: Select a property group the calculated object class property shall be added to. The calculated object class property will then be visible in class-based content areas of the object class which include the property group.
    • Comments: Optionally enter a comment explaining the purpose of the calculated object class property in to Alfabet Expand users.
    • Hint: Enter a comment explaining the purpose of the calcuated object class property to the end user. The hint will be visible as tooltip on the user interface:

      Ex_ClassModel_PropertyHints