checkedarraymenuitems(
ARRAY
,
ITEM
,
OPTION
,
VALUE
)

The checkedarraymenuitems( function converts a carriage return delimited array into a series of menu items, some of which may be checked.


Parameters

This function has four parameters:

array – a carriage return separated array of values to be included in the menu (see Text Arrays.

item – item to be checked. This may be single item, or it can be a carriage return separated array (in which case each matching item will be checked with a dash, to indicate multiple items selected).

option – one or more options that modify the appearance generated menu items. See below for descriptions of each option. The option name can be specified in either upper or lower case.

value – the value for the option specified in the previous parameter.


Description

This function converts a carriage return delimited array (see Text Arrays) into a series of menu items (see Custom Menus and LMSL, with one or more of those menu items checked. In its simplest form this function takes two parameters, a text array and the item to be checked. This example will create a menu that contains all of the cities that have been entered into the current database (of course this might be a very long menu). The name of the city in the current record will be checked.

menu("Cities")+
   checkedarraymenuitems(listchoices(City,cr()),City)

Multiple Selected Items

The Item parameter can itself contain a carriage return separated array. If it does, more than one menu item will be checked. However, the check will be a dash instead of a checkmark, to indicate that multiple items are selected. If you prefer to always use checkmarks even when multiple items are selected, add the option "MIXED",false(), like this:

menu("Toppings"),
    checkedarraymenuitems("Pepperoni"+cr()+"Sausage"+cr()+Meatballs"+cr()+
            "Tomatoes"+cr()+"Olives"+cr()+"Mushrooms",
        pizzaToppings,
        "MIXED",false())

Customizing Appearance of Menu Items

In addition to the array parameter, you can also specify one or more option/value pairs that modify the menu appearance, like this:

menuitem(title,option1,value1,option2,value2,option3,value3)

Here is an example that creates an Cities menu that is displayed in blue, using the font Futura Condensed.

menu("Cities")+
   checkedarraymenuitems(listchoices(City,cr()),City,"FONT","Futura Condensed","COLOR","0000FF")

The arraymenuitems( function supports the appearance options FONT, SIZE, STYLE, COLOR and INDENT. For more information about these appearance options see the menuitems( function.

Use the CODE option to set up one or more procedure statements to run when a menu item is chosen (see the menuitem( function for details on this option). Within the code, any occurrence of «» will be replaced with the name of the menu item. In this example, the menu again lists the cities in the database. Choosing one of the cities causes Panorama to select the records containing that city.

menu("Cities")+
   checkedarraymenuitems(
       listchoices(City,cr()),
       City,
       "CODE",{
           select City="«»"
       })

You can also use the IDENTIFIER option to set up an identifier for each generated menu option (see the menuitem( function for details on this option). Like the CODE option, within the identifier any occurrence of «» will be replaced with the name of the menu item. Here is an alternate example that also allows the user to select records containing a city.

menu("Cities")+
   checkedarraymenuitems(
       listchoices(City,cr()),
       City,
       "IDENTIFIER","«»",
       "CODE",{
           select City=info("menuidentifier")
       })

If no CODE option is set up, the generated menu items will be assigned a default menu action. See the menuitem( function for details.

Using a Different Separator Character

The arraymenuitems( function normally assumes that each element in the array is separated by a carriage return character. The SEPARATOR option allows you to specify a different separator character (or series of characters).

checkedarraymenuitems("Gold|Silver|Bronze","Silver","SEPARATOR","|")

Note: Both the Array and Items parameters use the same separator. In this example, both Tue and Thu will be checked (with a dash).

checkedarraymenuitems("Mon|Tue|Wed|Thu|Fri","Tue|Thu","SEPARATOR","|")

Extra Arrays

You can specify two extra arrays for use with this function, ExtraArray1 and ExtraArray2. If used, these arrays should be carriage return separated, and should have the same number of elements as the primary array. You can insert these arrays into the Code and/or Identifier options using «1» and «2». This example creates a menu that lists cities, but then performs a selection based on both the city and the state.

menu("People")+
    checkedarraymenuitems(
        arraybuild(cr(),"",{City}),
        theCity,
        "EXTRAARRAY1",arraybuild(cr(),"",{City+State}),
        "CODE",{
            select City+State="«1»"
        })

History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, but now allows the font, size, style and color to be modified, and also allows multiple selected items. (Note: In Panorama 6.0 and earlier versions this function was called checkedarraymenu(. Now either checkedarraymenuitems( or checkedarraymenu( can be used.