Example 2 Simple Dynamic Picklist

Visual LANSA

Example 2 - Simple Dynamic Picklist

Create a reusable part called FLDVIS02 using the source code following.  This is will provide picklist contents for DEPTMENT:

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_OBJT *implements #Prim_dc.iDynamicPicklist)
 
Mthroutine Name(Load) Options(*redefine)
 
#Picklist.RemoveAll
Select Fields(*all) From_File(Deptab)
#Picklist.Add( #Deptment #Deptdesc )
Endselect
 
Endroutine
 
End_Com
 

Use the option to add a dynamic picklist.  From the prompter, select FLDVIS02.

The following code will be added to the visualization source code:

Begin_Com Role(*Dynamic_Picklist #FLDVIS02) Name(#DynamicPicklist)
End_Com
Begin_Com Role(*Visual #PRIM_EVPL) Name(#VisualPicklist) Appearance(DropDownList) Componentversion(1) Height(19) Width(209)
End_Com
 

As with all picklists, dynamic or static, the NoMatchAction property needs to be set to determine what in the event of the underlying field value not being found in the picklist.  For most situations, ShowValue is probably the best choice.

The new Visual_host reusable can now be used as follows:

Define_Com Class(#Deptment.VisualPicklist) Name(#...)

 

Ý 3.6.13 Dynamic Visualizations