|SAS/AF Software: Class Dictionary|
The Data Form and Data Table classes make use of several key terms and concepts. A SAS table (also known as a "data set") is a collection of data values organized into rows and columns.
Relative row number refers to the relative position of the row within the table (ignoring any deleted rows, and taking into account any WHERE clause or index key). Absolute row number refers to the actual physical location of the row within the table (taking into account deleted rows and ignoring and WHERE clause or index key). Absolute row number is not supported by all SAS data files.
|How are "viewers" and "models" used in Data Form and Data Table?|
The functionality of the Data Form and Data Table classes is accomplished by the use of a model and viewer. The model retrieves data and delivers it to the viewer for display. Generally, the model controls any action that is directly related to the data that is being displayed, for example, the column labels that are used in the form or table, the columns from the table (data set) that are included in the display, which rows for the columns are displayed, and the format associated with the data values. The viewer, on the other hand, controls the display and how users interact with it, for example, the movement within the form or table, including scrolling or paging through the columns.
Because the functionality is accomplished by using both a model and a viewer, the model and viewer must be able to communicate. The term used for this connection is attached, that is the model is attached to the viewer. When you use the Data Form and Data Table classes, the model is automatically attached for you. The model that is used with Data Form and Data Table is the Data Set Data Model class. Because the model is automatically attached, you can call both the model methods and the viewer methods on the data form or data table.
|What is the model SCL?|
The model SCL
is separate from the frame's associated SCL entry. The model SCL entry is
associated with a particular data form or data table object. It initializes
computed columns and performs error checking and data validation. It also
allows you to reference the columns by name.
The model SCL for a data form or data table is associated with the data form or data table through the SCL Entry field in the object's attributes window. Specify the name of the model SCL entry in this field.
To edit the model SCL for a data form or data table, display the build-mode pop-up menu for the object, select [Form] (if the object is a data form)(or [Table] (if the object is a data table), and then select [Edit SCL...]. Note that the [Edit SCL...] item will be grayed out if you have not specified an SCL entry in the attributes window for the data form or data table.
Compile the model SCL for a data form or data table, by using one of the following:
Note: Compiling the model SCL from the BUILD window
will cause an error at run time.
You can use the following three types of variables in your SCL program:
Note: You do not need to declare
these in an SCL program; the column variables are automatically declared as
the same type and length as the columns in the table.
Each column in the model has a corresponding column variable in SCL. When a user modifies the column values of the model, the values of the corresponding SCL variables are automatically updated. Similarly, when the SCL program modifies the value of a variable, the value of the corresponding column in the model is updated. If the column variable is associated with a data set column, the column in the data set is updated also.
Noncolumn variables are initialized to missing values, blank, or to initial values given in declarative statements (such as ARRAY statements) before SCL is executed.
Note that the following methods cannot be called from the model's SCL entry:
The following methods can be called from the model SCL, but they will not execute until the model SCL completes its execution:
The following methods must be called from the model's SCL entry in the INIT, MAIN, TERM, or column labels:
|Controlling Execution in the Model SCL|
Program execution in the model SCL entry assigned to a Data Form or Data Table object is controlled by grouping statements into sections. Each section of the program begins with an SCL label and ends with a RETURN statement. Model SCL programs can include the following six labeled sections:
You cannot assign initial values to columns variables (whether computed columns or data set columns) in the DFINIT section. Only variables that are not part of the data set can be initialized in this section because there is no current row during the processing of this block.
The FSEINIT label is synonymous with the DFINIT label; if both labels are present, only the DFINIT label is run.
Note: If the viewer being used is a table editor,
then the INIT label runs for each row that is displayed in the table. For
example, if the table displays 10 rows, then INIT runs 10 times, executing
the SCL code in it each time. When a row is locked for editing, the INIT label
runs for the locked row.
Typical uses of the statements following the DFTERM label are to
The FSETERM label is synonymous with the DFTERM label; if both labels are present, only the DFTERM label is run.
The model SCL respects the following SCL CONTROL statement arguments:
See SAS Component Language: Reference for more information on the CONTROL statement.
|Effect of Protecting Columns|
You can prevent users from modifying a column or columns by "protecting" the column or columns. Columns can be protected by using the _protectColumn method or by setting the "protected" attribute for that column or columns. Note that the effect of protecting columns is different in a data form than in a data table.
When a data form or data table is in browse mode, all of the columns are protected.
In both the data form and data table, labeled sections for protected columns do not run.
|When are tables opened?|
The table (data set) associated with a data form or data table is opened
at build-time in browse mode. If you specify
for the Data Mode and
Member for Lock Mode
in the Attributes window of your object, you cannot test your application
from the SAS/AF Build environment.
|DATAFORM Catalog Entries|
DATAFORM catalog entries can contain column customizations for the following classes: Data Table, Data Form, Table Editor, and Form Editor. In addition, DATAFORM catalog entries also contain layout information for all of these classes.
(For more information on table editors and form editors, see the Table Editor Class and Form Editor Class.)
You can specify that a data table and a data form use the same DATAFORM catalog entry. This approach enables customizations to be shared between both classes with the use of a single catalog entry.
To specify a DATAFORM catalog entry, enter its name in the DATAFORM Entry field of the Data Table or Data Form Attributes window.
For example, when you initially open the Attributes window, you can enter the name of a catalog entry in the DATAFORM Entry field or you can leave the field blank. Then, you can make customizations to your frame object. When you return to the Attributes window, you again have an opportunity to enter the name of a catalog entry in the DATAFORM Entry field.
For details on how changing the name of the catalog entry in the DATAFORM entry field can save or lose your customizations, see the following table.
|Before customizations, if the DATAFORM Entry field contains...||After you make customizations and specify a name for the DATAFORM entry as...||Then, the customizations are...|
|nothing (blank)||a new DATAFORM catalog entry||saved to the new DATAFORM catalog entry. In a data form, the layout is not changed.|
|nothing (blank)||an existing DATAFORM catalog entry||lost; the object uses any customizations from the existing DATAFORM catalog entry. In a data form, the previous layout is lost and replaced by the saved layout in the new DATAFORM entry.|
|the name of a new DATAFORM catalog entry||another new DATAFORM catalog entry||saved to the new DATAFORM catalog entry that you specify after you make customizations. In a data form, the layout is not changed.|
|the name of a new DATAFORM catalog entry||an existing DATAFORM catalog entry||lost; the object uses any customizations from the existing DATAFORM catalog entry. In a data form, the previous layout is lost and replaced by the saved layout in the new DATAFORM entry.|
|the name of an existing DATAFORM catalog entry||a new DATAFORM catalog entry||lost; the object uses default customizations. In a data form, the previous layout is lost and a new default layout will be created for you.|
|the name of an existing DATAFORM catalog entry||another existing DATAFORM catalog entry||lost; the object uses any customizations from the existing DATAFORM catalog entry that you specify after you make customizations. In a data form, the previous layout is lost and replaced by the saved layout in the new DATAFORM entry.|
Top of Page
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.