How to create and use catalog keys?


Product(s):Cube
Version(s):6.1 to 6.5
Area:Other

Catalog keys define items that vary each time an application in a catalog is run. With catalog keys, users can develop one model to achieve many tasks with different parameter values, input files and run certain process only depends on the selection criteria.

Solution

In this sample catalog, we will demonstrate several examples on creating different types of catalog keys and the usage of those keys in script.

A catalog key is defined by its type (integer, character, etc.) and control type (the input method). Keys used in the sample catalogs includes character keys, integer keys and Boolean key with control type using Edit, Combo List, Combo Edit, Radio Button, and Spin Control. The figure below gives a general overview of the keys included in the sample catalog:


The application shows how to use those keys.


In the first Pilot program, all the key values are printed out as a text file. The intention of this is for you to understand how we can refer to those keys and retrieve their values in other programs.

Matrix program step #2 shows how to retrieve a key value and use it in the script.
Note #1: Matrix 0 is a special case that the program will fail. Since the key used in that program (myVal_Edit) is defined as integer with extra specification in Properties > Advanced… forcing it as string! To run it, just double click the program and check the error message in the PRN file.

Matrix step #3 is an example to use Boolean key.
Note #2: Boolean=1 is checked and Boolean=0 is unchecked. In the script, you should use values 1 and 0 for condition check.

Matrix step #4 is an example to include catalog key in the input file name. The way to do this is right-click an input file, and select Link to > Link to Catalog Key… then in the pop-out dialog, specify the file name with catalog key (i.e. Input\OD_{myYear}.MAT).


Matrix step #5 give an example to use character key.
Note #3: listAttribute is a character key with radio button. But in the Properties > Advanced… we specify its output value to be converted to the number of the item selected from the list.

How to use and practice this catalog?

1. Open the catalog in Cube.

2. Double click the Base scenario, Cube will open the window for you to edit key values. You can put in values for any of the keys here. But certain keys have a range for the input value. If an invalid value is specified, you will have a pop-out window.


3. Keys are listed in the key panel. To check the specification of a key, just right-click and select Properties. You can also add a key here by selecting Add.


4. You are encouraged to create different kind of types and control with extra specifications in Range, list of allowed values and Advanced.


communities.bentley.com/.../catKey.zip