Chapter Contents |
Previous |
Next |
SAS/AF Software: Class Dictionary |
If you want to expand the functionality of the external file model, subclass it directly and override the methods you want to modify.
If you are making a model to view data other than catalog entries or external files, subclass the Text Model Template class. In this case, define all of the methods for the class to provide the functionality specific to your data. For an example of creating a new model by subclassing the Text Model Template class, see that class.
Subclassing the External File Model |
This example creates a model subclass of the external file model that, when connected with a text viewer, adds the word "Line" followed by the line number to the beginning of each text line:
build sasuser.textview.filesub.classFILESUB.CLASS is the name of the external file model subclass. Set the parent class to SASHELP.FSP.EXFILEDE, the name of the External File Model class. FILESUB.CLASS will inherit methods from EXFILEDE.CLASS.
Additional Attributes
, select
Methods
to bring up a list of all
of the methods defined for this class. For this example you only need to
override the _getData method.
Source Entry
field specify
SASUSER.TEXTVIEW.FILESUB.SCL as the location for the new SCL code for the
method.
build sasuser.textview.filesub.scl
GETDATA: method buffer attr $ 200 maxlen row col 8 cchar $ 1 rc textlist attrlist 8; call super(_self_, '_get_data_', buffer, attr, maxlen, row, col, cchar, rc, textlist, attrlist); buffer = "Line " || row || " " || buffer; endmethod;
The _getData method calls the external file model's _getData method to get its usual functionality and then modifies the returned text string with the line number information.
rm make 'text viewer'
Data Source
, select
Other
and in the field to the right enter in the
name of the new class, SASUSER.TEXTVIEW.FILESUB.CLASS. Press RETURN.
Additional Attributes
, select
Data class attributes
to select a
file to view. Select OK to close the External File Attributes window and again
to close the Text Viewer Attributes window.
The file appears with the line number information.
For an additional example of subclassing a model, see the Text Model Template class.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.