Creating Objects for the Model

This chapter discusses how to:

Click to jump to parent topicCreating a Class

A class has the following default properties:

Inheritance principles must be considered while a model is being built. Click anywhere in the model structure view to ensure focus on the modeling area.

To create a class:

  1. Click the Create Class icon in the right margin, then click the parent class, or, select a class, then select Insert, Class.

    To create multiple classes, hold down the Shift key, click the Create Class icon, then click the parent class, or, select a class, then select Insert, Multiple Classes.

    The New Class dialog appears.

    Note. A class may have either subclasses or domain members. If a class has domain members, they must be deleted before a subclass can be added.

  2. Type a name into the Name entry field of the New Class dialog. The dialog prompts with a .cms file name based on the string you enter. Before continuing be sure the name is correct according to the following:

  3. Click the Change button to specify a different file name. A class object can be saved to an existing .cms file.

    Once a name is accepted, the class name can be changed within the model, but the file name cannot change.

  4. If you are adding a single class, click OK to end the process, or click Add Another to continue adding classes. Or, If you are adding multiple classes, type “Return” to make another, or click the cursor arrow in the menu bar to revert to the normal Windows cursor.

When a class is created the following events occur:

Click to jump to parent topicDeleting a Class

To delete a class, select it and press the delete key.

Deleting a class:

To remove the corresponding file from the .csp file, click the File View tab. Locate the associated class file and right-click to open the context-sensitive menu, then select Remove File From Project. Note that deleting a class in Visual Modeler does not remove the corresponding .cms file from the file system.

Click to jump to parent topicChanging Class Structure

It is possible to reuse parts of a diagram with the Reparent and Copy and Paste features.

Compare the following two figures:

To reparent a class:

Drag and drop it on a class that does not have domain members.

To copy and paste a class:

Copy a class and paste it on another class that does not have domain members. The original class remains unchanged in the diagram. Any domain members and relationships will be transferred along with the copied class to its new location. If the class is on the same hierarchical level (a sibling) the class will be automatically renamed to keep it unique. If the class is not a sibling, the name is unchanged.

Note. Copying and pasting a class will not copy the corresponding selection points. If the copied class is a leaf class, a selection point will be created for it; however that selection point will have the default properties, not the properties, of the original class's selection point.

Click to jump to parent topicAdding Class Attributes

Class, domain member, constraint, and selection point values and attributes can be specified or edited in the context-sensitive Properties editor.

The figure shows the Properties editor for a class in which the user has defined attributes, and the Internal property is set to False, so that the attribute values will be imported from an external source.

Note. The SQL Query field is not shown unless Internal is set to False.

To add an attribute to a class:

Click the Add button at the top of the panel to open the Create a New Property dialog. You can either use the dialog to enter the name, type, and value, or click the OK button to add a blank row to the table for editing. Possible types are Boolean, float, int, String, and date.

An entry in the Value column becomes the default for child classes and for domain members. The value can be changed in the class in which it is defined, or in an internal domain member. When the SQL Query property is set to False, internal values are generally ignored, however, if a database happens to have a null value, the default value from the model will be substituted.

Click to jump to parent topicCreating Internal Domain Members

A domain member is an instance of a class. You can create any number of domain members. An internal domain member is one that is stored within the model rather than a database or another system file.

To create internal domain members:

  1. To create a single domain member, click the domain member icon, then click the parent class.

    To create multiple domain members, hold down the Shift key, and click the domain member icon, then click the parent class. Alternatively, select a class, then select Insert, Domain Member or Insert, Multiple Domain Members.

  2. Click OK to complete the process, or click Add Another to continue adding domain members on the same class. The New Domain Member dialog appears.

  3. Type in a name. The name cannot include \, =, <. >, :, ", (, or ). The initial character cannot be dollar ($) or underscore (_), but these characters can be included in other positions. An asterisk (*) cannot be used alone, but it can be used in combination with other characters.

  4. When you are finished creating domain members for this class, select another class, or click Cancel.

    Or,

    To stop creating multiple domain members, click the cursor icon in the Windows menu bar to revert to the normal Windows cursor.

Click to jump to parent topicCreating a “None” Domain Member

When a control is single-select, an item named None is automatically displayed in the Model Tester when you launch it. If the selection point flag Optional is set to True, None is computer-selected (unless a default was set). It is important to understand that this “generated” None is not a domain member, and it has no value. As such, None does not participate in constraints.

When a user selects None at run time, it means “there is no selection made on this selection point.”

None is not generated for a multi-select control.

For required single-select controls, none has no meaning, so the Model Tester has an option to hide None on required controls.

If you want an item named None to be selectable on a multi-select or single-select control, you must create a domain member for that purpose. It is helpful to name this domain member something other than None, such as “No Thanks” or “I don’t want any” to avoid confusion with the “generated” None.

Click to jump to parent topicAssigning Values to Attributes

Type appropriate values in the Value column. The figure shows the attributes for an internally defined domain member. The naming restrictions for domain members also apply to attributes.

Note the use of font styles in the Properties editor:

Click to jump to parent topicInputting Date-Type Attributes Manually

You can input date-typed attributes on classes and domain members manually, through the Property Editor, and through an SQL query from a database. The Visual Modeler also supports date-typed data in compatibility, requirement, and dynamic default constraints.

You can express values for dates using the full ISO 8601 format. However, any time zone, hour, minute, and sub-second information will be truncated during the compilation process to yield a YYYY-MM-DD format. The validity of dates is checked during the compilation process and error messages are generated for any invalid dates detected. Advanced Configurator stores the dates as strings in their YYYY-MM-DD format since many date operations can be performed on the ISO 8601 format using string manipulation and comparison functions.

Date values loaded from a database are retrieved and converted to the YYYY-MM-DD format. Thus, you can store and retrieve date values in formats other than YYYY-MM-DD.

Note. Strings can be input directly from the user interface if they are in a parseable date format.

You can also use date data in expressions.

See Creating and Editing Expressions.

Click to jump to parent topicSetting Up Binding for External Domain Members

Relationships can be created between classes or selection points and domain members obtained from a database. Setting up the modeling environment to work with external objects requires:

Click to jump to top of pageClick to jump to parent topicSelecting a Primary Table

Select a class, and in the Properties editor, set Internal to False. The SQL Query field appears. Click the Edit button to display the primary table dialog. (If no databases are listed in the drop down on the upper left, the Visual Modeler is not connected to a database.)

See Specify a Database Connection.

Simple Queries

Simple queries, where a database table column corresponds exactly to the model needs, do not require an advanced SQL query.

To write a simple query:

  1. Type the database table name into the Primary Table field.

    Note. The table name and all other names associated with the database are case-sensitive.

  2. Type a Column name from your database into an empty Table Column cell. To map the values to class attributes, make a selection in the corresponding Class:Attribute drop down.

  3. (Optional) Enter a Where clause. The SELECT and FROM portions of the query are derived from the dialog inputs. You need only enter the WHERE portion.

  4. (Optional) Check the Distinct check box to ensure that repeated values are not displayed.

  5. Click the Domain Member Key box next to the value you want displayed on the domain member. At least one row must be chosen as Domain Member Key. The Domain member key does not have to match the Primary Key in the database.

Note the following important points about queried data:

Secondary Table Option

To join a secondary table to a Primary table, click the Secondary Table button. Database-to-class property mapping is similar to that for the Primary window, with these exceptions:

Note. Limit using secondary tables to situations where they are truly necessary. Secondary tables are preferred to defining advanced queries, but they slow Visual Modeler performance and increase compilation time.

Advanced Queries

An Advanced Query is required if filtering must be applied to the table data and if you plan to do any data manipulation in the SQL. For example, you could calculate someone’s age based on the current date and their birth date and return that value as AGE. You may also need an advanced query if you are using nested select statements or complex joins.

When you use an advanced query, the runtime system can not dynamically read additional database data as requested by run time components. Any data needed must be provided by the query specified in the Advanced Query specification.

You can not request additional attributes on the UI with advanced queries. For example, with a simple query, you don’t have to map LONG_DESCRIPTION into the model, but you can still display it at run time since it is added onto the query for the class. With advanced queries, all attributes that will be displayed or otherwise referenced (for example., in pricing) must be mapped into the model.

Note. An advanced query must be written such that the first column returned is returned as “$NAME”. This should be the domain member key (or equal to the domain member key).

To enter an advanced query:

  1. Click the Advanced Query check box. The Primary Table field will disappear.

  2. Type an SQL Server or Oracle query into the Enter Advanced Query field to:

  3. Add the data call portion of the query:

    In an example where a class’ attributes name, attr1, and attr2 are taken from tableX, and there is a need to order by attr1, the query (for Oracle) is similar to this:

    select name as "$NAME", attr1, attr2 from tableX order by attr1

    The column mappings are:

    $NAME -> tableXID(domain member key) attr1 -> columnA attr2 -> columnB

  4. Perform the remaining steps as described in the preceding instructions “Simple Queries.”

    Note. Do not use the Advanced query unless it is absolutely necessary. The simple query is preferred because it can be optimized at run time.

Using Table Aliases

Using a table alias helps allows you to:

In particular, a table alias can help you create joins and differentiate between multiple instances of the same table. To create a table alias, follow the table/view name with a name of your choosing—the alias. When you refer to that table instance in the where clause, prefix the column name with the prefix. The SQL below is what the system actually generates at run time. Note the prefix names used in the WHERE section—you can see them defined in the FROM section.

SELECT DISTINCT ( CAST(kit.PROD_COMPONENT_ID AS NVARCHAR(4000))) AS '$NAME' FROM PS_PRODKIT_COMPS kit, PS_EOEP_PRICE_LIST list, PS_EOEP_PRICE_LIST recur, PS_⇒ PROD_ITEM prod WHERE kit.SETID = 'COM01' and kit.PRODUCT_ID = 'TEL200002' AND list.RECURRING_FLG = 'N' and list.PRICE_LIST_ID = 'COM_PRICE' and list.SETID = kit.SETID and list.PRODUCT_ID = kit.PROD_COMPONENT_ID AND recur.RECURRING_FLG = 'Y' and recur.PRICE_LIST_ID = 'COM_PRICE' and recur.SETID = kit.SETID and recur.PRODUCT_ID = kit.PROD_COMPONENT_ID AND prod.SETID = kit.SETID and prod.PRODUCT_ID = kit.PROD_COMPONENT_ID

Click to jump to parent topicFiltering and Manipulating Table Data

An Advanced Query is required if filtering must be applied to the table data and if you plan to do any data manipulation in the SQL. For example, you could calculate someone’s age based on the current date and their birth date and return that value as AGE. You may also need an advanced query if you are using nested select statements or complex joins.

Click to jump to parent topicStoring a Dynamic Default Quantity in a Database

A special character is used to separate the quantity values and policy from the constraint value. For instance, if you want to default four fans with a SUM policy, the string “FANA~4~SUM” might appear in the database to denote that default. The format for a value stored in a database can be one of the following:

<value> <value><delimiter><quantity-or-expression> <value><delimiter><quantity-or-expression><delimiter><policy>

The <value> token is the value to be used by the constraint. In the prior example, this would be the symbol FanA. The <delimiter> token is the special separation character. In the example, this was the character ‘~’. You can specify the delimiter character in the Project, Settings dialog.

The <quantity-or-expression> token is either a numeric quantity or the name of an expression. The <policy> token is SUM, MIN OF, or MAX OF.

Click to jump to parent topicRetrieving Expression Values and Externs from a Database

You can populate LHS expressions and RHS extern values from stored data. Visual Modeler and the compiler recognize data output from the database in specific format and will populate the rows of constraints with that data.

The format for LHS expressions is:

<comparator><space><"const" or "f(x)"><space><value or expression name>

Examples: <= const 2 and > f(x) expSum

Format for RHS externs is < “true” or “false”> to indicate whether it is required (true) or optional (false).

You should have one column in the database for each expression or extern in the constraint.

Click to jump to parent topicWorking with Selection Points

The selection point is the model component that communicates directly with the HTML control in the UI. By default, a selection point is created for every leaf class that participates in a relationship.

A selection point has these properties, which are displayed and editable in the properties table:

Name

Type String. By default, the name of the selection point is the class name with Selection appended. This name can be changed. If you change the name, all constraints or expression that use it must be updated.

 

Filename

Type String. Filename and path to this object.

 

Type

Type String. The name of the original class.

 

Quantity

Type Boolean. Determines default quantities for selections. False indicates that domain members, when selected, have a quantity of 1. True indicates that domain members, when selected, have the quantity of 1 or greater, as set in the Defaults editor (explanation follows), which replaces the Def Choice property.

 

Use Min/Max

Type boolean. Settings for minimum and maximum number of choices allowed for the control, and for minimum and maximum quantity of each domain member allowed. Determines single- and multi-select control type. When set to False (default), the control is optional, and only one domain member can be selected (single-select). (You can also specify single-selection with the property Multi Sel = False.) When Use Min/Max is set to True, the Defaults editor replaces the Def Choice property

 

Defaults

The default quantity policies and values for each domain member in the selection point. Click Edit to open the Edit Default Choices dialog. This quantity is compared to the quantity that is assigned to the domain member during run time when it is selected by a dynamic default constraint. It is applied if the dynamic default quantity does not meet the requirement indicated by the policy.

See Quantities in Modeling.

Quantity Policy column—One of four ways to apply the static quantity value in the Quantity Value/Expression column to each domain member:

  • Overridable, Overridable f(x)

    Assign the quantity to the domain member only in the absence of a dynamic default quantity on the domain member.

  • Min of, Min of f(x)

    Check that the largest of the dynamic quantities assigned to the domain member (assuming it was selected more than once) is the specified static quantity or greater. If it is not, assign the static quantity value.

  • Max of, Max of f(x)

    Check that the largest of the dynamic quantities assigned to the domain member (assuming it was selected more than once) is the specified quantity or less. If it is not, assign the static quantity value.

  • Sum, Sum f(x)

    Check that the specified quantity equals the sum of the dynamic quantities assigned to the domain member (should it be selected multiple times), otherwise assign the static quantity.

Quantity Value/Expression column—Static quantity. Click on the cell to display the selector arrows and set the static quantity value, or a predefined expression, of a domain member. If you use an expression, the value resulting from the expression will be used.

A value of 0 indicates that there is no minimum, maximum, or summed quantity requirement on the domain member. 1 - n is the quantity to be compared to the dynamic quantity, to be applied to the domain member if the policy requirement is not met.

Domain Member column—(not editable) Name of the domain member in the selection point.

Use Quantity Policy for All Domain Members—Specifies whether and how to apply a default quantity to all the domain members. Policy and Quantity fields specify the same entries as the Quantity Policy and Quantity Value cells for individual domain members described above.

Multi-Sel

Type Boolean. Determines whether a selection point is single- or multi-select.

False indicates that only one selection can be made on the selection point. Be sure to choose Def Choice if desired (explanation follows). In this sense, the Quantity property duplicates the Multi-Sel property (explanation follows).

True indicates that multiple selections can be made on the selection point. When True is selected, the input row Defaults appears in place of the Def Choice property, and the Defaults Editor is made available for setting the default choices, their default quantities and policies.

SP Min/Max

Click the SP Min/Max Edit button to open a dialog to specify:

  • Selection point Minimum Number:

    0 indicates that the selection point is optional.

    1 – n indicates that the selection point is required and must have at least 1 or n selections.

  • Selection point Maximum Number :

    Unbounded indicates that there is no limit to the number of discrete domain members the user can choose (up to all members available). For efficient model maintenance, use this setting when the number of domain members is expected to vary over the life of the model or during run time.

    1 – n indicates a static limit; 0 has no meaning.

  • Expression—the minimum and maximum are determined by an expression. Choose the expression from the drop down.

  • SQL Query —the minimum and maximum are determined by query of the indicated database. Click the ellipsis button to open an edit window in which to create the query. Be sure to indicate the database to query.

    Note. The Configurator system looks for the selection value in the first column of the first row of the data returned by the SQL query. Be sure to create a query that returns only one column and one row.

  • Explanation —Message that you want to appear when the min/max limits are violated, advising the user when not enough choices are made, or too many. Explanations can be parameterized to indicate the objects involved.

    See Creating Parameterized Explanations.

 

DM Min/Max

Minimum and maximum limits on the quantity of each domain member that may be selected.

  • Domain member Minimum quantity: The least quantity that can be specified of a domain member when selected.

  • Domain member Maximum quantity: Unbounded indicates that there is no limit to a domain member’s allowable quantity.

  • Expression—If you want the minimum or maximum quantity to be determined at run time by an expression, select Expression and then select the desired expression (already defined) from the drop down list.

  • SQL Query —the minimum and maximum are determined by query of the indicated database. Click the ellipsis button to open an edit window in which to create the query. Be sure to indicate the database to query. row.

    Note. The Configurator system looks for the selection value in the first column of the first row of the data returned by the SQL query. Be sure to create a query that returns only one column and one.

  • Explanation—Message that you want to appear when the min/max limits are violated, advising the user when too few or too many of a domain member are selected. Explanations can be parameterized to indicate the objects involved.

    See Creating Parameterized Explanations.

 

Optional

Type Boolean. Default is False (required). If False is set, the user must make a selection on the control before the configuration can be verified.

Note. The same condition applies if Use Min/Max is True and Minimum Number is not 0.) If Optional is True and Multi Sel is False, the item None will be automatically added to the control at compile time.

 

Def Choice

Type String. Optional. The item in the control that is pre-selected. Can be a domain member name or None, which means “none of these domain members”. If Optional (described below) is True, the <None> option is computer-selected. If Optional is False (the control is required), None has no meaning. This property is not available if either Quantity or Multi Sel is True, as these properties indicate that quantities greater than 1 are to be specified.

See Creating a “None” Domain Member.

To view a model’s selection points, select View, Show, Selection Points or click the selection point icon in the toolbar. The selection points are displayed on the left side of the model structure view.

A selection point participates in all relationships that refer to the original parent class. If a relationship is made directly between a selection point and another object, that relationship is confined to the selection point. To add a selection point, drag a class from the components view into the selection point area, or drag a class from the Model Structure View into the selection point area.

To delete a selection point, select it in the Model Structure View, then press the Delete key. Once created, a selection point can participate in relationships with classes or class attributes members in the modeling editor.

Note the Properties Editor entries for selection points. Because selection points interface with the UI, settings made here determine how controls behave at run time. A selection point can be designated as multi-select (the user can select more than one of its items), and/or optional. If a control is optional, the user does not have to make a selection on the control. If a selection point is required, the model will not be considered valid until a selection is made. Selection point properties (Table Editor) New selection points appear at the bottom of the selection points area, and at the end of the selection points listing in the component view.

A class can have many attributes, but if attribute values are to be selectable at run time, they must be made visible from the selection point. To do this, right-click on a selection point that has attributes, select Set Visible Attributes, and check any attributes that you want to display at runtime. When an attribute is made visible, it will be shown on all the selection points for a class. The display of an attribute cannot be confined to certain controls.

Click to jump to parent topicInternalizing Data

External data can be extracted from the database and automatically inserted and defined in the model as for manually entered data.

This is a necessary step if the model is to be deployed in an another environment where configuration will take place locally on a standalone version of Advanced Configurator. The Configurator Administration Console has a more comprehensive internalization function than does Visual Modeler. It can internalize data stored in files other than those in a database.

Internalizing data is a “one time” operation. Once it is performed, changes to the data in the database will no longer be reflected in the model. To internalize data on an ongoing basis, use the option available with the compile command on the Server’s Administration page.

To internalize external data using the Visual Modeler, use the Project, Internalize Model command.

See Also

Administration Console