6 24 1 Using a Data Class

Visual LANSA

6.24.1 Using a Data Class

You can use a data class component:

To create a variable

When you want to create a simple variable which has the characteristics (type, properties etc.)  of a field or a primitive data class.

See 6.24.2 Data Classes as Variables.

 

In a spin edit box

When you want a numeric field to be displayed with spin edit buttons, add a spin edit box to your form and then specify the field as the value of the DataClass property of the spin edit.

For example, if you add the field #SALARY to a form, it is displayed as a plain input/output field. If you want this field to be displayed with spin buttons, you must first add a spin edit box to your component and then assign the field #SALARY as the DataClass property of the spin edit. The spin edit box will then behave exactly like the #SALARY field apart from the spin buttons.

Spin buttons are used to increment numbers and therefore only a numeric field can be used as the value of the DataClass property in a spin edit box.

 

In a combo box

When you want  to apply the characteristics (such as type and length) and rules of a field to the value entered in the edit portion of the combo box,  specify the field as the value of the combo box's DataClass property.

For example, if you want the value entered in the combo box to be a numeric value accepted by the #SALARY field, make #SALARY the value of the combo box's DataClass property.

Another, less common use for the DataClass property of a combo box is to show the value of a specified field in the edit portion of the combo box.

Normally the edit portion of the combo box shows the value of the current item of the first column (DisplayPosition 1). If you want the value of another field than the one that was used as the source of its first column to be shown in the edit area, specify this field as its DataClass. This field can be one of the fields used as the source of other columns in the combo box or any other field in the repository. Normally you would not specify any of the fields used as columns in the combo box as the DataClass value because if you want a column displayed in the edit area, it is simpler to change its DisplayPosition to 1. A more typical usage would be to create a field that combines the current values of several columns and use this field as the DataClass so that all the values are visible in the edit area. 

For example if the combo box has a column for the first name and surname of employees, a field that concatenates the values of these two fields could be used as the DataClass.

 

In a property sheet

When you want to create property sheet entries. A data class needs to be assigned to every entry in the property sheet to handle how the value for the entry is displayed and modified. See 6.26 Property Sheets.

 

 

Ý 6.24 Data Classes