Drop Down Lists

LANSA for i

Drop-Down Lists

A control that is a variation of a list box. A drop-down list only displays one item until the user takes an action to display the other objects or choices.

  • Must be an alphanumeric field with a maximum length of 60.
  • Any identification is valid.
  • On NPT's the field will display the same as a normal field, except that the field will be output-only and followed by the drop-down indicator "V", or the character specified in DC@OSVEROP *DROPDOWN=x option. This character is locked-in at compile-time for the best performance when executing.
  • Drop-Down lists are defined through the DDxx input/output attribute, where xx is AA to 99. The xx defines the drop-down list and links the field to the list data.
  • Cannot wrap onto another line.
  • A drop-down list may be removed (or effectively cleared) by the DROP_DD_VALUES Built-In Function described in the Technical Reference Guide.
  • The list is created and data is added to the drop-down list through the ADD_DD_VALUES Built-In Function described in the Technical Reference Guide.
  • It is suggested that a site and/or application standard be created for drop-down attributes. The advantages of this is that conflicts are prevented and drop-downs could be loaded in an initialization function then the drop-down attribute could be specified in any function after that. For example the drop-down attribute 'DDST' could be loaded with valid state codes. Then any field that requires a state code to be entered, just requires the 'DDST' attribute to be specified against it for the drop-down list to be active.
  • A drop-down list exists for the entire life of your LANSA session.
  • There is a limit of 20 active drop-down lists per LANSA session. More than 20 lists may be added and dropped, but the total number at any one time cannot exceed 20.
  • There is also a limit on the size of each drop-down list. The maximum size of each drop-down list, including value separators is 6200 characters.
  • The DROP_DD_VALUES Built-In Function should always be used BEFORE a drop-down list is loaded with its initial data to ensure there is no other data in the list.
  • The separator character specified should not exist in the data being added or unexpected results will occur.
  • There are a number of ways of using the ADD_DD_VALUES Built-In Function to load the data into a drop-down list. The following examples illustrate some of the different methods.

One value at a time. Hard-coded values.

        DEFINE     FIELD(#DROPDATA) TYPE(*CHAR) LENGTH(10) 

                     INPUT_ATR(DDST)

 

        USE        BUILTIN(DROP_DD_VALUES) WITH_ARGS(DDCO)

 

        USE        BUILTIN(ADD_DD_VALUES) WITH_ARGS(DDCO *DFT 

                     'RED') TO_GET(#RETCD)

 

        USE        BUILTIN(ADD_DD_VALUES) WITH_ARGS(DDCO *DFT 

                     'BLUE') TO_GET(#RETCD)

 

        USE        BUILTIN(ADD_DD_VALUES) WITH_ARGS(DDCO *DFT 

                     'YELLOW') TO_GET(#RETCD)

 

        USE        BUILTIN(ADD_DD_VALUES) WITH_ARGS(DDCO *DFT 

                     'GREEN') TO_GET(#RETCD)

 

        USE        BUILTIN(ADD_DD_VALUES) WITH_ARGS(DDCO *DFT 

                     'WHITE') TO_GET(#RETCD)

 

Many values at once, separated by the defined separator character.

        DEFINE     FIELD(#DROPDATA) TYPE(*CHAR) LENGTH(3) 

                     INPUT_ATR(DDST)

 

        USE        BUILTIN(DROP_DD_VALUES) WITH_ARGS(DDST)

 

        USE        BUILTIN(ADD_DD_VALUES) WITH_ARGS(DDST '''/''' 

                     'NSW/VIC/QLD/SA/WA/NT/TAS') TO_GET(#RETCD)

 

One value at a time, loaded from a file.

        DEFINE     FIELD(#DROPDATA) TYPE(*CHAR) LENGTH(24) 

                     INPUT_ATR(DDCT)

        OVERRIDE   FIELD(#CATEGORY) TO_OVERLAY(#DROPDATA 1)

        OVERRIDE   FIELD(#CATDESC) TO_OVERLAY(#DROPDATA 5)

 

        USE        BUILTIN(DROP_DD_VALUES) WITH_ARGS('DDCT')

 

        SELECT     FIELDS((#CATEGORY) (#CATDESC)) 

                     FROM_FILE(CATMST)

 

        USE        BUILTIN(ADD_DD_VALUES) WITH_ARGS('DDCT' *DFT 

                     #DROPDATA)

 

        ENDSELECT