Using the OData Service (Obsolete)

Creating a DataWindow Using an OData Service

Select the OData Service data source in the DataWindow wizard:

  1. Select File > New from the menu bar and select DataWindow.

    If there is more than one target, select the target where you want the DataWindow to be created from the drop-down list.

  2. Choose the presentation style for the DataWindow object and click Next.

  3. Select the OData Service datasource and click Next.

  4. Select the OData profile and click Next.

    In the SQL painter:

    • You can select one table.

    • The Sort, Group, and Having tabs are not available.

    • The Results tab is obsolete, because it is used by PowerBuilder .NET.

    • In the Where tab you can specify some selection criteria using the WHERE clause for the SELECT statement.

  5. When you complete the query, click OK.

  6. Review your specifications and click Finish.

At runtime, the DataWindow or DataStore can manipulate OData service data, which includes retrieving, updating, inserting, and deleting the data.

Setting the Connection Information for the OData Service

As with other databases, use the SQLCA Transaction object (or user-defined transaction object) to retrieve and display data from the OData service in a DataWindow or DataStore.

Set the appropriate values for the transaction object.

Connect to the OData service.

Set the transaction object for the DataWindow or DataStore.

Retrieve and update the data.

When the processes are complete, disconnect from the OData service.

The code looks something like this:

SQLCA.DBMS = "ODT"
SQLCA.DBParm = "ConnectString='URI=http://esx2-appserver/TestDataService/Employee.svc'"
//connect to the service
connect using SQLCA;
dw_1.SetTransObject(SQLCA)
dw_1.Retrieve()
...
//disconnect from the service
disconnect using SQLCA;

For more information on using the global Transaction object, see Using Transaction Objects in Application Techniques.