Chapter Contents

Previous

Next
SAS/AF Software: Class Dictionary

Using the Catalog Entry List Model

You can use the Catalog Entry List Model class in conjunction with a viewer control for model/view communication. When you drop a model on a control in a frame, or you set the control's model attribute to the name of the instantiated model object, the items attribute of the view is automatically set to the items attribute of the model.

For example, add a list box control and a catalog entry list model to a frame, then set listbox1.model to catalogentrylist1. To display a list of catalog entries in the listbox, specify a value for catalogentrylist1.catalog.

You can also use the model in an SCL program to retrieve a list of catalog entries from a specified SAS catalog. Once you specify a valid SAS catalog name for the object's catalog attribute, simply query the items attribute to get the list of catalog entries. To further qualify the selection, specify other attribute values for the object before you query items.

For example, the following code instantiates a catalog entry list model and returns a list of all CLASS entries in the catalog sasuser.myclasses:

init:
  dcl sashelp.classes.catalogentrylist_c.class catobj; 
  dcl list classList;
  dcl num rc; 
  classList=makelist(); 
  catobj = _new_ sashelp.classes.catalogentrylist_c(); 
  catobj.catalog = 'sasuser.myclasses';
  catobj.typeFilter = 'class';
  classList = catobj.items;
  call putlist(classList); 
  catobj._term(); 
  rc=dellist(classList);
return;

Working with Catalog Entry Names

The Catalog Entry List Model items attribute is populated by a list of catalogs. Each list item is assigned a unique name that is equal to libname.catalog.entry.type. The unique name appears in the viewer to which you assign the model as long as the model's catalogEntryDisplayed attribute is set to Yes.

If catalogEntryDisplayed is set to No, the name will not appear in the items attribute list, which means it will not display in any associated view. Each item on the list, however, is a named item that also corresponds to the catalog entry name. You can query the items attribute list using the NAMEITEM function to determine each catalog entry's unique name.

  1. Create a frame with a listbox, catalogentrylist model, and a text label.

  2. Add the following SCL code:

listbox1:
  textlabel1.label=nameitem(Catalogentrylist1.items, Listbox1.selectedIndex);
return;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.