Variant component can be used to store a variant value
Ancestors - Data Class (PRIM_DC) Object (PRIM_OBJT)
A Variant is used to represent a value whose data type is unknown when compiling. The ValueType property is used to test the data type. LANSA is a strongly typed environment. Normally the fields and variables used in an application relate to specific database table columns where the type of data is fixed. Unless the application requires complex generic programming, PRIM_VAR is unlikely to be required for most development purposes.
In this example, the EditorChanged event is returning the value when data is changed in the grid. As the event is defined for any column type, its value must be a variant. Prim_Var is used here to provide feedback as to the kind of data value being changed.
Function Options(*DIRECT) Begin_Com Role(*EXTENDS #PRIM_FORM) Clientheight(440) Clientwidth(975) Height(479) Layoutmanager(#TableLayout_1) Left(152) Top(225) Width(991) Define_Com Class(#PRIM_TBLO) Name(#TableLayout_1) Define_Com Class(#PRIM_TBLO.Row) Name(#Row_1) Displayposition(1) Parent(#TableLayout_1) Define_Com Class(#PRIM_TBLO.Column) Name(#Column_1) Displayposition(1) Parent(#TableLayout_1) Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutItem1) Column(#Column_1) Manage(#Grid) Parent(#TableLayout_1) Row(#Row_1) Define_Com Class(#PRIM_GRID) Name(#Grid) Captionnoblanklines(True) Columnscroll(False) Componentversion(1) Displayposition(1) Height(440) Left(0) Parent(#COM_OWNER) Showselection(True) Showselectionhilight(False) Showsortarrow(True) Tabposition(1) Top(0) Width(975) Columnbuttonheight(22) Rowheight(22) Define_Com Class(#PRIM_GDCL) Name(#GridColumn1) Displayposition(1) Parent(#Grid) Source(#EMPNO) Width(12) Widthtype(Fixed) Define_Com Class(#PRIM_GDCL) Name(#GridColumn2) Displayposition(2) Parent(#Grid) Source(#SURNAME) Width(25) Widthtype(Fixed) Readonly(False) Define_Com Class(#PRIM_GDCL) Name(#GridColumn3) Displayposition(3) Parent(#Grid) Source(#GIVENAME) Width(25) Widthtype(Fixed) Readonly(False) Define_Com Class(#PRIM_GDCL) Name(#GridColumn4) Displayposition(4) Parent(#Grid) Source(#SALARY) Width(25) Widthtype(Fixed) Readonly(False) Evtroutine Handling(#Com_owner.CreateInstance) #Com_owner.Load Endroutine Mthroutine Name(Load) Select Fields(*All) From_File(PSLMST) Add_Entry To_List(#Grid) Endselect Endroutine Evtroutine Handling(#Grid.EditorChanged) Value(#Value) Define_Com Class(#prim_var) Name(#VariantValue) #VariantValue := #Value #Com_owner.Caption := ("&1 - &2").Substitute( #VariantValue.ValueType #VariantValue ) Endroutine End_Com
Name | Description |
---|---|
Boolean | Boolean is the value of the variable as Boolean |
Component | Component is the value of the variable as component reference |
ComponentClassName | ComponentClassName is the name of the component's class. Inherited from Object (PRIM_OBJT) |
ComponentMembers | ComponentMembers provides access to all the member components of this component Inherited from Object (PRIM_OBJT) |
ComponentPatternName | ComponentPatternName is used to qualify the class of the component. Inherited from Object (PRIM_OBJT) |
ComponentTag | Generic space allowing a value to be stored for the instance Inherited from Object (PRIM_OBJT) |
ComponentType | ComponentType gives you access to the type information about the component Inherited from Object (PRIM_OBJT) |
ComponentTypeName | ComponentTypeName is the fully qualified name of the component's class. Inherited from Object (PRIM_OBJT) |
Decimal | Decimal is the value of the variable as decimal |
Integer | Integer is the value of the variable as integer |
Name | Name identifies the component Inherited from Object (PRIM_OBJT) |
Owner | Owner owns this component Inherited from Object (PRIM_OBJT) |
Parent | The component instance to which this instance is attached. The visual container for a control or the collector of a set of child instances Inherited from Object (PRIM_OBJT) |
String | String is the value of the variable as string |
UnicodeString | Returns the value of the variant as a Unicode string |
UsePicklist | Controls whether the values in the picklist are enforced Inherited from Data Class (PRIM_DC) |
Value | Value of the data class |
ValueType | ValueType test the type of value in the variant |
Name | Description |
---|---|
CreateInstance | CreateInstance is signalled when an instance of a component is created Inherited from Variant (PRIM_VAR) |
DestroyInstance | DestroyInstance is signalled when an instance of a component is about to be destroyed Inherited from Variant (PRIM_VAR) |
Name | Description |
---|---|
AssignEmpty | AssignEmpty assigns no value to the variable |
AssignNull | AssignNull assigns a null value to the variable |
GetValue | Get the current component value Inherited from Data Class (PRIM_DC)
Value |
SetValue | Set Field value Inherited from Data Class (PRIM_DC)
Result, Value |
Febuary 18 V14SP2