<
 

Resources

SAS® AppDev Studio 3.0 Developer's Site

Overriding a Method   About It See It Build It  

To create the Overriding a Method Example:

In some cases, you will find that you need to extend or customize the functionality of EMDDB_M (the underlying model to the MultidimensionalTable component) for your specific needs. In this example, you will override the _SET_APPLICATION_ method in SAS/EIS software to print "In _set_application_ override" to the log.

To override the _SET_APPLICATION_ method in SASHELP.EIS.EMDDB_M.CLASS:

  1. In SAS, type build sasuser.testovr.testovr.class on the command line.

  2. In the Class Editor window, enter SASHELP.EIS.EMDDB_M.CLASS in the Parent class field. Select Methods under Class Properties.

  3. In the Methods table, select _SET_APPLICATION_ from the list of methods. Right-click with the mouse and select Override from the pop-up menu. The source entry field should now show SASUSER.TESTOVR.TESTOVR.SCL. Tab to the Source Label entry field and change that to setprop. Right-click with the mouse and select Source from the pop-up menu to bring up the source window for SASUSER.TESTOVR.TESTOVR.SCL.

  4. Enter the following code in the Source window.

    length _method_ $ 32;
    setprop: method appllist 8 optional=errcode 8;
    _method_ = _method_;
    _self_ = _self_;
    call super(_self_,_method_,appllist,errcode);
    put 'In _set_application_ override.';
    endmethod;
    
  5. Select Build [arrow] Compile.

    Note: You will see a message at the bottom of the screen indicating that the code has been generated.

  6. Select File [arrow] Close to close the Source window and select YES in the message window to save changes.

  7. Exit from the Class Editor window and select YES from the message window to save the class.

To add a new repository and attribute dictionary:

  1. If you have previously created a new Repository and Attribute Dictionary, you can skip to the section titled To change your EIS model to use your new override. Otherwise, create a new attribute dictionary using the following steps:

    1. Enter reposmgr on the command line to open the Repository Manager window.

    2. Select Attribute Dictionary to open the Dictionary Registration window.

    3. Click New.

    4. Enter newattr for Dictionary Name, sasuser for Library, and SASUSER MDDB Example Sales Data for the Description.

    5. Click OK to close the Register Dictionary (New) window, click Close to close the Dictionary Registration (New) window, and then click Exit to close the Repository Manager window.

  2. On the command line, enter EIS to bring up the EIS Main Menu and then double-click the Setup icon.

  3. In the Setup window, select Search Path. In the Search Path window, select Attribute search path. From the arrow pull-down, select SASUSER. In the Available column, you should see the new attribute dictionary you created. Highlight the attribute dictionary with a single click and then, using the arrows, move it to the Selected column. Make sure the Use search path check box is selected. Close the Setup windows and return to the EIS Main Menu.

  4. In the EIS Main Menu, double-click Metabase to open the Metabase window.

  5. In the Metabase window, select SASHELP for the repository, select MDDB Example Sales Data, and then click Copy under the Tables list box to open the Copy window.

  6. In the Copy window, use the down arrow beside the Repository field to select SASUSER, then enter SASHELP.PRDMDDB for the Name entry.

    NOTE: The name here must be the same as the original being copied or webEIS will not pick up the copied registration.

  7. Click OK to return to the Metabase window. Use the down arrow beside the Repository field to select SASUSER. You should see your copied registration.

To change your EIS model to use your new override:

  1. At this point you should be in the Metabase window. If not, enter EIS to bring up the EIS Main Menu, then double-click Metabase to open the Metabase window.

  2. To add a MODEL attribute, right-click in the window to access the pop-up menu. Select Edit [arrow] Attribute Dictionary.

  3. Select the attribute dictionary you created from the pull-down list.

  4. If you do not have a MODEL in the list of attributes, click Add and enter the following values:

    Field Name Value
    Name MODEL
    Type DATA
    Description sasuser model attribute
    Interactive method SASHELP.CLEATTR.MODEL.FRAME

    Leave the remaining fields blank, and click OK in the Properties dialog box. Click Close in the Attribute Dictionary dialog box to return to the Metabase window.

    Note: If you already have an MODEL in the Attributes list, you can use it and go on to the next step.

  5. In the Metabase window, select SASUSER from the pull-down and then select MDDB Example Sales Data from the list of tables.

    Note: If you already have a MODEL in the Attributes list, you can use it and go on to the next step.

  6. If you do not have a MODEL in the list of attributes, click Add under the Attributes list box and select MODEL from the list. Click OK to open the Initial Table Entry window. Enter SASUSER.TESTOVR.TESTOVR.CLASS as the path name for your model and click OK.

    Note: The model must be a CLASS type entry.

  7. Close all SAS/EIS windows and exit SAS.

Viewing your data:

  1. Start webEIS.

  2. Make sure that the SAS IOM Spawner is running. To start it, select Start [arrow] Programs [arrow] SAS AppDev Studio [arrow] Services [arrow] SAS V9.1 < img src="../common/arrow.gif" alt="[arrow]" /> Start SAS V9.1 IOM Spawner.

  3. Create a new document named Method Override, and name the first section data.

  4. In the Data window, click the ellipses (...) button next to the Server Connection field.

  5. In the Document Connections list, select your local host (which should be <userid>'s PC) and click Edit.

  6. In the Edit Connection window, select the Advanced tab. Make sure that the Allow connections to be activated at design time, Log client calls to the server, and Route SAS Server log to client System.out options are all selected.

  7. Close both the Edit Connection and Document Connections windows to return to the Data window.

  8. Connect to your local machine by selecting your machine in the Server Connection field. Then, select SASUSER MDDB Example Sales Data (SASUSER SASHELP.PRDMDDB) from the Data Source list box.

  9. Add the visual components and arrange them as shown on the See It tab:

    Component Icon
    Multidimensional Table Table graphic

  10. Specify the data that you want to display in your table and chart. Drag the Geographic hierarchy and drop it on the Rows item. Drag the Product Line hierarchy and drop it on the Columns item. Drag the Actual Sales analysis variable and drop it on the Measures item. Select View [arrow] Refresh to load the data into the table.

  11. Select View [arrow] Preview Mode to switch to Preview mode.

  12. To validate your work, go to your folder AppDevStudio [arrow] webEIS and open your webEIS text document. You should see text noting In_set_application_override.