Define the Collection

Visual LANSA

Define the Collection

In this example we are using a collection-style collection to add  menu items to the menu item collection. This is how the collection of the menu items is defined:

Define_Com Class(#PRIM_KCOL<#PRIM_MITM #EMPNO>) Name(#MENU_ITEMS) Collects(#PRIM_MITM) Keyedby(#EMPNO) Style(Collection)

 

  • The Name of the collection is #MENU_ITEMS.
  • The collection will contain menu items (#PRIM_MITM).
  • The Keyedby property specifies the repository field (#EMPNO) used as the key to the collection.
  • Its Style is Collection

Submenu

The submenu which will contain the menu items is defined, but it is not associated with the menu title yet because initially it contains no items and it is defined with a dynamic reference which means that the submenu will be created only when a reference is explicitly set to it:

DEFINE_COM class(#PRIM_SMNU) name(#Sub_menu) reference(*dynamic)

 

Ý Example 4: Collection of Menu Items