Customize Options (Select a User Class Dialog)
You can customize the display by clicking the Customize link on the
Create a Display from a User Class):
To use the default CustomizeClass frame to customize the generated display using the Customize option, select the Utility!CustomizeClass option:
The following frame will appear, displaying the specifications stored in the user class from which the display is to be generated:
The left panel displays all the attributes of the class, plus the simple attributes belonging to any of them that are also classes. In the previous displayed example, the principal business object is of class user_profile, with two business object attributes of class Airport and (array of) Flight, respectively.
The class itself has tagged value settings that you can customize when generating this frame; each attribute also has its own settings that can be customized.
The lower right panel displays the settings for the element selected on the right. In the displayed example, the selected element is the principal class itself, in this case, the user_profile class; and the class, database, and display properties on the right are specific to the user_profile class.
The buttons at the bottom of the dialog have the following functions:
Apply
Apply any property changes to the display-generation copy of the principal object’s class source, and close the dialog. That copy is the one used when generating the display – the original is unchanged.
Cancel
Close the dialog without making any change to the class source.
Set as default
Apply any property changes to the principal object’s actual class source.
This permanently changes the user class. It can be used as an convenient alternative to the Extended Properties editor when similar settings changes need to be made to a number of attributes.
Save as named display
Apply any property changes to a separate copy of the principal object’s class source, and store it in a named tagged value belonging to the principal object.
That named copy will be listed in the top right panel from now on, and if clicked will be used to populate all the settings in the dialog.
This provides a convenient way to record settings that are likely to be reused to create useful displays.
Note: Any changes to the subsidiary classes (Airport and Flight in the previous example) are recorded on copies of those classes that are stored with the principal class's copy—the originals of the subsidiary classes are unaffected in all circumstances.
The properties in the lower right panel are stored as tagged values in the class source or attribute, with the tag set to the name of the property and the value containing the property's value as a string object.
If the user class was partly or wholly generated using the Attribute, Insert from Database Table facility in the Class Editor, then these properties will have been instantiated automatically during that process. If not, the settings must be applied either manually (using this dialog or the Extended Properties Editor), or using a utility such as the Property Changer, suitably customized.
Class Properties
The properties are as follows:
Item_value
Specifies an expression that evaluates to the representative value of a particular object of this class. In the previous example, each user_profile is characterized by the user's email identifier.
Class_icons
Specifies the filehandle of a bitmap to provide the icon for the class.
The bitmap can be a single image of any supported format, but it can be useful to specify a .ico file with multiple images, or a 24-bit .bmp file with multiple images in the OpenROAD format. In particular, generated tabfolder-based displays with bitmapped tabs will make use of the image closest in size to the required size.
Tablename
Specifies the name of the database table which stores the values of the business object's simple attributes.
Corrname
Specifies the correlation name to be used for this tablename in SQL queries.
You may need to change this wherever it occurs.
Restriction
Specifies any SQL restriction clause which must be included in any where clause when data relating to this class is retrieved from the database.
In the previous example, if the application containing these frames was for use only in the United Kingdom, but the database was international, the restriction clause might be:
us.stateorcountry = 'UK'
The default restriction is:
1 = 1
Updatekey
Specifies the column or columns the update whereclause must specify values for in order to perform an unambiguous database update of the business object's properties.
In the previous example, the email column serves this purpose.
Lookupkey
Specifies the column or columns that the select whereclause must specify values for in order to retrieve the business object's properties from the database.
Note: This is not usually the same as the updatekey, which is often a surrogate key unknown to the end user, but rather the combination of known business properties by which the end user would categorize that business object; it is not necessarily unique. Examples are employee first plus last name, or chemical name plus batch number, or book name plus author, or name plus address.
In the previous example, the email column serves this purpose.
Display_width
Specifies the optimal width for the generated display.
If this is not specified, the display generator uses the current width of the Frame Editor as the target width.
If the specified dimensions are not achievable, the generator provides a layout with the closest achievable match to the width.
Display_height
Specifies the optimal height for the generated display.
If this is not specified, the display generator uses the current height of the Frame Editor as the target height.
If the specified dimensions are not achievable, the generator provides a layout with the closest achievable match to the width.
Attribute Properties
Attribute properties are as follows:
Category
Specifies the category of information to which this property belongs.
The default categories are identifier, location, contact, financial data, dates.
The user class generator attempts to identify each attribute's category by a heuristic combination of datatype, name, size, and cardinality. However, misassignments are likely and need to be caught and corrected.
Subtype
Specifies the business datatype of this property.
Applications and databases use a small set of datatypes into which a wide variety of business datatypes are coerced. For example, an integer may represent a unique identifier, a count, a status, a scale; a varchar may represent a code, a name, a status, a comment.
The user class generator attempts to identify each attribute's subtype by a heuristic combination of datatype, name, size, and cardinality. However, misassignments are likely, and need to be caught and corrected.
RW
Specifies the accessibility of this property.
Allowed values are R (readonly), RW (readwrite), and RW1 (read always, write once).
Default: RW
Values
Specifies an expression which evaluates to the list of allowed or typical values for this property.
By default, the user class generator sets this to be:
SQL: db_tablename.db_columnname
In the previous example, the email attribute would have a Values setting of:
SQL: user_profile.up_email
The following code illustrates how this expression could be evaluated in a procedure's code:
declare
application = AppSource default null;
source = ClassSource default null;
attribute = AttributeObject default null;
expression = varchar(256) not null;
valuedef = ValueDefinitionProxy;
list = ChoiceList default null;
enddeclare
…
/*
** Get the values expression from the user_profile email attributeobject
*/
application = curprocedure.ObjectSource.ParentApplication;
source = application.FetchComponent(componentname=myuser_profile.ClassName);
source.Attributes.Find(
attributename='name', value='email', rownumber=Byref(indx));
attribute = upsource.Attributes[indx];
expression = upsource.GetTagText(tag='values');
/*
** Evaluate the expression to get a choicelist of possible values
*/
valuedef.Definition.Value = expression;
list = valuedef.ListTextValues();
/*
** Display the list in an optionfield
*/
field(myoptionfield).ValueList = list;
Columnname
Specifies the name of the database column that stores the value of this attribute of the business object.
Tablename
Specifies the name of the database table to which the columnname belongs.
Datatype
Specifies the datatype of this attribute, including length, where appropriate.
In the previous example, the datatype of the email attribute is:
nvarchar(100)
Keyprofile
Specifies the key profile of this attribute.
This is a combination value (combined by addition), as the attribute may be involved in multiple key-related roles. For this reason the individual key roles are specified as toggle options. These are:
Lookup
Specifies whether the attribute forms part of the lookup key.
Value: 8
Update
Specifies whether the attribute forms part of the update key.
Value: 4
Join
Specifies whether the attribute forms part of a foreign key.
Value: 2
Join (mapped)
Specifies whether the attribute forms part of a foreign key that is used to link the business object to another business object.
Value: 1
Sequence
Specifies the position in the "business sequence" of attributes that this occupies.
This is important, as OpenROAD sorts attributes alphabetically, but the attributes of an address (for example) are not presented in alphabetical order.
By default, the sequence uses the sequence of columns in the database table, as these are usually created in business-logical order. However, you may need to change this wherever it occurs.
Display_profile
Specifies the display profile of this attribute.
This is a combination value (combined by concatenation), because the attribute may be displayed in multiple scenarios. For this reason the individual display roles are specified as toggle options. These are:
Main
Specifies whether the attribute is displayed when one of the principal object's attributes.
Value: 1
Sub
Specifies whether the attribute is displayed when one of a subsidiary single object's values (in a panel).
Value: 2
Tbl
Specifies whether the attribute is displayed when one of a subsidiary array's values (in a tablefield).
Value: 3
List
Specifies whether the attribute is displayed when a set of business objects containing that attribute are listed for selection.
Value: 4
Title
Specifies whether the attribute is included in a title for the business object.
Value: 5
Proxy
Specifies whether the attribute is included in the label for a field displayed in place of a subsidiary object panel.
Typically, clicking the field would open the subsidiary object in a separate frame.
Value: #
If the attribute is displayed in all circumstances ("12345#"), then "*" can be used instead.
Default: "*"