Try OpenEdge Now
skip to main content
Managed Adapters Guide
Database Managed Adapter : Tutorial 1: Using the Database Adapter : Step 9: Defining the output parameters
 

Step 9: Defining the output parameters

You have already defined the input parameter, the variable ID, used to supply the Database Adapter with the customer ID number. Now you can define the list of output parameters - all the data that the Database Adapter should return to your business process as the result of the query.
Before defining the output parameters, the Database Adapter Configurator must know the format of the result set from the SELECT statements, or in other words - the query result meta-data.
To define the output parameters:
1. In the SQL Statement dialog box as shown in Step 8: Defining the SQL statement above, click Get Result MetaData to display the Query Tester dialog box.
The list of our input variables currently contains just one variable, ID, that you have defined before.
Note that the Query Result pane is blank. Before executing the statement in the SQL Statement Preview pane, you need to define values of the input parameters; in this case, ID.
2. In the Value box, enter the customer ID of one of the existing users, using one of the IDs you had created in Step 1: Creating the customer database table.
3. Click Execute. The Query Tester dialog box shows the results of the query in the Query Result pane.
The Query Result pane shows the personal data for the selected customer.
Note: If the Query Result pane is empty, then the ID may not be specified correctly. You can connect to the database and check for validity of the ID.
4. Click OK to close the Query Tester dialog box. You will see that the Output Parameters tab in the SQL Statement dialog box is now enabled.
5. Click the Output Parameters tab. The list of the columns selected from the table is displayed.
Note that the Map To column is empty, indicating that none of the columns is mapped to an output parameter. Mapping to an output parameter is the way to get data out of the Database Adapter. The adapter returns a list of output variables to your business process and now you must define the table fields in which the output variables are stored.
a. Click the ellipsis ()button in the "NAME" row. The Variable Definitions dialog box appears.
b. Click Add to define a new variable; in this example, name. The Variable Editor dialog box now appears.
Note the default value should be set to unknown, since this value will be displayed when the query returns no customer. For example, if the customer ID is wrong, the Customer Name field will display "unknown".
c. Click OK. The new variable name will appear in the variable list of the Variable Definitions window.
d. Select name and click OK. The Output Parameters tab shows the Map To for the NAME output parameter set to "@name", indicating that the column is mapped to the variable name.
6. Repeat the above step for the PHONE row and map it to phone.
The final SQL Statement dialog box appears
Note that each of the columns has been mapped to the corresponding output variable. The Database Adapter configuration is now complete.
7. Click OK to close the SQL Statement dialog box.
8. Click OK in the DBAdapter Configurator dialog box to save the updated configuration.This action also opens the Map Configurator, which is described in the following section.