Progress
AppBuilder
Developer’s Guide
Creating a SmartDataObject Master
The individual static SmartDataObjects you employ as building blocks in your application are instances of one or more master objects. Using the AppBuilder’s SmartDataObject design Wizard, you can create any number of masters that produce different data streams based on the queries you define in them.
Design Considerations
Before you start the SmartDataObject design Wizard, you should consider these questions:
- Will you need to define a temp-table first to reduce the amount of processing? Large quantities of data can affect performance. If your application must repeatedly traverse a very large database, you might get a significant performance increase by first subsetting to a temp-table, and then operating on that subset instead.
Note that although the Wizard will allow you to define such a temp-table, and will allow you to assign it as the SmartDataObject’s data source, you must write the code by hand that actually locks and copies records from the permanent table. This population step must take place before you give the SmartDataObject access to the temp-table at run time, if the rest of your application expects to find records in the table.
- What databases and tables do you want this SmartDataObject to use? This base query can be refined or sorted at run time.
- What fields do you want to expose to client objects, and what properties (such as read-only) do you want to set for each data element?
- What are your plans for validating data on the client side (the user interface side) and the SmartDataObject side? See the "Data Validation Limitation" section in this chapter for a discussion of an unusual and potentially important issue.
Creating the Master
AppBuilder’s SmartDataObject Wizard has four pages. Only pages 2 and 3 involve significant work:
To create a SmartDataObject master, follow these steps:
- Open the Choose dialog box by clicking on the SmartDataObject tool icon in the Object Palette. When the dialog box opens, start the SmartDataObject Wizard by choosing New:
NOTE: You could also start the Wizard by choosing File
![]()
New and selecting the SmartDataObject item from the list, or by right-clicking the icon in the Palette and selecting New SmartDataObject from the pop-up menu.
- Page 1 of the SmartDataObject Wizard appears:
![]()
- When you have read the introductory text, choose Next to move to page 2:
![]()
- If this SmartDataObject will operate on one or more temp-tables, choose the Define temp-tables button to open the Temp-Tables Maintenance editor. Using the editor, define the temp-tables this SmartDataObject will use. See the "Temp-Tables Maintenance" section in "Frequently Used Dialogs," for information about how to use the editor.
NOTE: The option to create a free-form query is not available to you at this stage. If you need or want to create a free-form query, you must create a placeholder using Query Builder and then edit the query after the Wizard completes. See the "Editing a SmartDataObject Master" section in this chapter, for further information.- Choose the Define Query button to start Query Builder. Define the base query this SmartDataObject will use. See the section "Defining and Editing Queries Using Query Builder" in this chapter, for information about how to use Query Builder.
- When you finish with Query Builder, you will see displayed on page 2 the text of the query you just created. When you are satisfied with your choices for temp-tables and query, choose Next to go to page 3 of the Wizard:
![]()
- Note that at this point, the list of fields is empty. Choose Add Fields to start the Column Editor, and use the editor to select the fields that you want to make available through this SmartDataObject. For information about how to use the Column Editor, see the "Selecting Database Fields for Browsing" section in this chapter.
- When you return from the Column Editor, the list will be populated with the fields you have chosen:
![]()
- Choose Next on page 3 of the Wizard to advance to the Wizard’s final page. If you successfully defined a database query and the related SmartDataObject RowObject temp-table fields, the Congratulatory screen displays. (If not, press the Back button and make any necessary changes.)
- Choose Finish to dismiss the Wizard and reveal the new SmartDataObject master, if it was not already visible:
![]()
- Choose File
Save and give the new master a descriptive filename. Note that, by convention, SmartDataObject filenames begin with d.
The new SmartDataObject master is now available for your use.
Note, too, that AppBuilder actually creates two different forms of the master. If you were to give it the name dExampleSDO and then check the filesystem, you would see
- A standalone version, named
dExampleSDO.w
This version is loaded whenever there is a local database connection. AppBuilder creates it with the DB–REQUIRED preprocessor value set to YES, since it should not load if there is no database connection.- A client-side version, named
dExampleSDO_cl.w
. AppBuilder creates it with DB–REQUIRED set to NO. This version is loaded when there is no local database connection, on the presumption that the application is running in client/server mode and the database is resident on the server side. This version is compiled with all DB–REQUIRED internal procedures stripped out, which can create a problem. See "Data Validation Limitation" in this chapter for further information.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |