To add the SCL code,
making the frame fully functional, open the frame SCL for the Display_data
frame (right-click anywhere in the frame and select
Frame
SCL). Insert the following code:
/* This is the frame SCL for the Display_data frame. */
/* */
/* The user selects a library from the LibrariesListbox. */
/* The TablesListbox is then populated. */
/* The user selects a table from the TablesListbox. */
/* The ColumnsListbox and Tableviewer1 are then populated. */
dcl num rc; /* Numerical variable used as a return code. */
dcl char(30) displayTable; /* A character variable. */
dcl list emptyList={}; /* Creates an empty list. */
/* Executes before the frame is displayed to the user. */
Init:
/* Disable the SubsetButton and the ClearSubset buttons */
/* by setting the 'enabled' attribute on each. */
/* There is nothing yet to subset or clear. */
subsetButton.enabled='no';
clearButton.enabled='no';
/*Set how the table is displayed in TablesListBox. */
datasetlist1.levelCount=1;
return;
/*Executes when a selection is made from the LibrariesListbox. */
LibrariesListbox:
if LibrariesListbox.selectedItem ne ' ' then
do;
/* Set the Data Set List model to point to the library selected. */
/* Because the Data Set List model is associated with the */
/* TablesListbox, the TablesListbox is populated. */
datasetList1.library=librariesListbox.selectedItem;
variableList1.dataSet=' ';
sasdataset1.table=' ';
/* Enable the SubsetButton now that there is data to subset. */
subsetButton.enabled='yes';
end;
return;
/* Executes when a selection is made from the TablesListbox. */
TablesListbox:
if TablesListbox.selectedItem ne ' ' then
do;
/* Concatenate the selected library and the selected table */
/* and give the result to the sasdataset model, the model */
/* supplying the Table Viewer with data. */
displayTable=librariesListbox.selectedItem || '.' ||
TablesListbox.selectedItem;
sasdataset1.table=displayTable;
variableList1.dataSet=displayTable;
SubsetButton.enabled='yes';
end;
return;
/* Executes when a selection is made from the ColumnsListbox. */
ColumnsListbox:
if listlen(columnsListbox.selectedItems) gt 0 then
/* Copy the list of selected columns to the sasdataset1 model, */
/* the model supplying the Table Viewer with data. */
sasdataset1.columnOrder=copylist(ColumnsListbox.selectedItems);
return;
/* Executes when the 'Subset with WHERE' button is pressed. */
SubsetButton:
if sasdataset1.table ne ' ' then
/* Call the WHERE subset window. */
rc = sasdataset1._setWhere(0, 'y');
/* If a WHERE expression is in effect, enable the 'Clear Subset' button. */
if rc=0 then ClearButton.enabled ='yes';
return;
/* Executes when the 'Clear Subset' button is pressed. */
ClearButton:
if sasdataset1.table ne ' ' then
sasdataset1._setWhere(emptyList); /* Clear the WHERE expression. */
ClearButton.enabled ='no'; /* Disable the 'Clear Subset' button. */
return;
term:
/* Delete the list when quitting. */
rc=dellist(emptyList);
return;
Save the code by selecting
FileSave, and then close the frame SCL window.
Because the frame
entry was already named Display_data.frame, the SCL entry that is
associated with the frame is automatically named Display_data.scl.
If you change the name of the frame later, the frame assumes that
the frame SCL name was also changed, so you must either change the
name of the SCL entry to match the frame, or edit the frame's SCLEntry
attribute to reference the original SCL entry.