Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
Web Objects : HTML mapping examples : Complex HTML mapping that includes a SmartDataObject : Creating a SmartDataObject
 
Creating a SmartDataObject
SmartDataObjects provide query logic that is separate from the rest of your application. As separate modules, they can be used by multiple applications, can be refined at run time, and can be modified more easily than queries that are embedded within applications. Another advantage to SmartDataObjects is that they can be used on an AppServer™ for multi-tier deployment. See OpenEdge Application Server: Developing AppServer Applications for more information.
SmartDataObjects can easily be created in the AppBuilder. The SmartDataObject associated with w-custdir.w is called dcustomer.w.
To create SmartDataObjects in the AppBuilder:
1. Choose File > New from the AppBuilder main menu. The New dialog box appears:
2. Select SmartDataObject from the list of SmartObjects.
Note that AppBuilder must be connected to a database in order to create a SmartDataObject. The procedures for starting and connecting to a database are described in OpenEdge Getting Started: WebSpeed Essentials.
3. Choose Next on the SmartDataObject Wizard, then choose Define Query from page 2 of the wizard.
4. In the Query Builder:
a. Add the Customer table to the Select Tables list.
b. Select the Sort button.
c. Add Name to the Selected Fields list.
5. Go to the next dialog box in the wizard (page 4) and choose Add Fields.
6. Choose Add and add all of the available fields to the Selected Fields list.
7. Go to the final page of the wizard and choose Finish. You will see a window labeled Untitled, which represents the SmartDataObject you just created. You can save it as dcustomer.w from the File menu of the AppBuilder.
When you save a SmartDataObject, you create a number of files: .w, .r, _cl.w, _cl.r, and .i. For more information about the function of these files, or for more information about SmartDataObjects in general, see OpenEdge® Development: ADM and SmartObjects® and OpenEdge® Development: ADM Reference.
For more information about creating SmartDataObjects with the AppBuilder, see the OpenEdge® Development: AppBuilder.