Release 10.1A: OpenEdge Development:
AppBuilder

> ## 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 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 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:

> 1. Introduction.

> 2. Creating the temp-tables, if any, and the query.

> 3. Selecting the fields the SmartDataObject will offer to visualization objects.

> 4. Congratulations.

> | To create a SmartDataObject master:

> 1. 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 Object Palette and selecting New SmartDataObject from the pop-up menu.

> 2. Page 1 of the SmartDataObject Wizard appears:

> 3. Click Next to go to Page 2 of the wizard:

> 4. The SmartDataObject supports an external super procedure that allows you to encapsulate business logic called the data logic procedure. You can reuse this data logic procedure or specify a unique data logic procedure for each SDO. Activate the Use SDO logic procedure to indicate you want to use a data logic procedure. Specify the appropriate template in the Use template field and the procedure name in the Logic procedure file name field.

> 5. When you have completed the logic procedure portion, choose Next to move to Page 3:

> 6. 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 for information about how to use the editor.

> 7. Choose the Define Query button to start Query Builder. Define the base query this SmartDataObject will use. See the "Defining and editing queries using Query Builder" section for information about how to use Query Builder.

> 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 for further information.

> 8. When you finish with Query Builder, you will see displayed on Page 3 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 4 of the wizard:

> 9. 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.

> 10. When you return from the Column Editor, the list will be populated with the fields you have chosen:

> 11. Choose Next on Page 4 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.)

> 12. Choose Finish to dismiss the wizard and reveal the new SmartDataObject master, if it was not already visible:

> 13. 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 file system, 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 the "Data validation limitation" section for further information.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095