Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Visual Hosts and Dynamic Picklists

A Visual Host allows you to define a reusable part to act as the edit portion of a field. This allows you all the flexibility of a reusable part while still taking advantage of LANSA Repository features for multilingual descriptions, labels, and column headings.

Dynamic Picklists Dynamic Picklists allow you to define the items in a picklist at runtime, usually by loading them from a table.

Prim_DC.iDynamicPicklist

Implementing iDynamicPicklist allows Implementing iDynamicPicklist allows a visualization reusable to load the picklist at runtime.

Load – The load method is executed during initialization and any time a monitored value or context changes.  This picklist instance is received via the Picklist map. 

     Define_Map For(*input) Class(#PRIM_PKLT) Name(#Picklist) Pass(*BY_REFERENCE)

The instance of the picklist is maintained at runtime meaning that the user must clear the list, if new data is required.

Department Picklist

In this example, the Load method will load the picklist from the Departments table, xDepartments.

Since you are building a dynamic picklist for a web page application, the reusable part must retrieve department data by executing the iiixDepartmentsDataServer server module's FindAll srvroutine.

1.  Create a New / Reusable Part / Object.

     Name     Name: iiiDepartmentPicklist.

     Description     Description: Department Visual Picklist.     Target

     Target Platform: Web Browser.

2.  Change the Begin_Com Role() to implement a dynamic picklist:

Begin_Com Role(*EXTENDS #PRIM_OBJT *implements #Prim_dc.iDynamicPicklist)

3.  Copy and paste the working list xDepartmentsList from the iiixDepartmentsDataServer server module at the top of the reusable part source.

...

  1. Define component for FindAll in server module iiixDepartmentsDataServer, named FindAll.
  2. Execute FindAll passing list xDepartmentsList.
  3. RemoveAll entries form PickList.
  4. Read all entries in list xDepartmentsList.
  5. Add each entry to PickList, passing xDepartmentCode and XDepartmentDescription.

  

   Your      Your code should look like the following:

     Mthroutine Name(Load) Options(*REDEFINE)
     Define_Com Class(#iiixDepartmentsDataServer.findall) Name(#FindAll)
     #FindAll.execute(#xDepartmentsList )
     #Picklist.RemoveAll
     Selectlist Named(#xDepartmentsList)
     #Picklist.add( #xDepartmentCode #xDepartmentDescription )
     Endselect
     Endroutine      Note

Note

Note:

  • The Picklist component is cleared before the FindAll.Completed event occurs.
  • The returned working list xDepartmentsList is processed in a Selectlist/EndSelect, adding all records to the Picklist component.

5.  Compile the iiiDepartmentPicklist reusable part.