Try OpenEdge Now
skip to main content
Java Open Clients
Using the Open Client Java OpenAPI to Directly Access the AppServer : Setting up parameters : Defining the schema for a ProDataSet parameter : Specifying the ProDataGraphMetaData object for a ProDataSet parameter
 
Specifying the ProDataGraphMetaData object for a ProDataSet parameter
Specify the ProDataGraphMetaData object together with any input ProDataGraph by passing them as parameters of the addDataset() or addDatasetHandle() method that you use to add the ProDataSet parameter to the ParamArray object. For more information, see DATASET and DATASET-HANDLE.
The following example adds a temp-table parameter defined with no indexes.

Example: OpenAPI fragment setting a ProDataSet parameter

// Create the ParamArray
ParamArray parms = new ParamArray(1);

// Create the ProDataGraphMetaData
ProDataGraphMetaData dgMetaData = new ProDataGraphMetaData("dsCustOrd");

// Create the ProDataObjectMetaData for the Customer table
ProDataObjectMetaData doCustMD = new ProDataObjectMetaData
                                 ("ttCust", 3, false, 0, null, null, null);

doCustMD.setFieldMetaData
            (1, "CustNum",  0, Parameter.PRO_INTEGER, 0, 0);
doCustMD.setFieldMetaData
            (2, "Name",     0, Parameter.PRO_CHARACTER, 1, 0);
doCustMD.setFieldMetaData
            (3, "SalesRep", 0, Parameter.PRO_CHARACTER, 2, 0);

// Create the ProDataObjectMetaData for the Order table
ProDataObjectMetaData doOrderMD = new ProDataObjectMetaData("OrderDetails",
6, false, 0, null, null, null);

doOrderMD.setFieldMetaData
            (1, "OrderNum", 0, Parameter.PRO_INTEGER, 0, 0);
doOrderMD.setFieldMetaData
            (2, "SalesRep", 0, Parameter.PRO_CHARACTER, 1, 0);
doOrderMD.setFieldMetaData
            (3, "OrderDate", 0, Parameter.PRO_DATE, 2, 0);
doOrderMD.setFieldMetaData
            (4, "ShipDate", 0, Parameter.PRO_DATE, 3, 0);
doOrderMD.setFieldMetaData
            (5, "TotalDollars", 0, Parameter.PRO_DECIMAL, 4, 0);
doOrderMD.setFieldMetaData
            (6, "OrderStatus", 0, Parameter.PRO_CHARACTER, 5, 0);

// Add the tables to the ProDataGraph meta data
dgMetaData.addTable(doCustMD);
dgMetaData.addTable(doOrderMD);

// Create and add the relations to the DataSet meta data
ProDataRelationMetaData relation = new ProDataRelationMetaData
                                   ("custNum", 0, 1, 1, "CustNum,CustNum");

dgMetaData.addDataRelation(relation);

parms.addDataset(0, null, ParamArrayMode.OUTPUT, dgMetaData);
For more information on the objects and methods for defining the schema of a ProDataSet parameter and on working with the ProDataGraph used to map a ProDataSet parameter, see AccessingABL ProDataSets.