Wiki

Scale Your Enterprise

User Tools

Site Tools


bw:databuilder_tool

This is an old revision of the document!


Introduction (DataBuilder)

This document described the use of the Bizweaver DataBuilder tool. This tool is used to create JSON and XML data structures for use with web service APIs.

Related Documents

The following documents contain additional information that may be helpful with the development of Bizweaver workflows.

Before You Begin

You will need to know, or have examples of , the data structures the API is expecting. This includes element (field names) and child objects within the structure. Keep in mind that names will generally require an exact match, including case.

General Notes

  1. Input will generally be from a SQL Reader step.
  2. The example used in this page is for JSON. The same general process is also used for XML.

General Process

  1. Create an input (SQL Reader) step for each dataset that will be needed. An example would be order header and order lines.
  2. Create a DataBuilder step for each dataset.
  3. Once all DataBuilder steps are created, add the lower-level datasets to the main dataset. The lower-level datasets are referenced by their Object Name. These are listed in the “Field Type” drop-down after they are created.
  4. The “CumulativeData” variable from the main DataBuilder step in referenced in the web service step that transmits the information to the API.

Sample Building JSON for SAP Business One on HANA

Workflow

This workflow builds two sections of a JSON structure for an SAP Business One sales order. The sections are the header and the rows. Each section consists of a SQL statement to gather the needed information and the DataBuilder to format the information. Once the pieces are constructed, the output is sent to the SAP Service Layer API in the WebService step. Other APIs will work in a similar manner.

Create Main DataBuilder Step

This should always contain the first items of the data structure.

  1. Enter a workflow step name.
  2. Select the data source from the Datasource Object drop-down list.
  3. Select the desired data structure type to be created (JSON or XML).
  4. Leave the “Add as an array” checkbox cleared unless you know that the top-level object needs to be any array. This is uncommon.
  5. Enter the name of the top-level object.
    1. The requirements of the receiving API will determine this.
    2. In some cases, a top-level object name is not used; e.g. SAP Service Layer and BigCommerce.
      1. If a top-level object name is not used, leave the field blank.
  6. Create a row for each value to be included in the structure.
  7. Enter the output field name values in the right-side grid.
    1. The Field Name value will need to exactly match (including case) the value the API is expecting.
  8. Select the field type from the drop-down list.
  9. Press <F4> to get a list of variables from the associated Datasource Object and select the appropriate value.

Continue this process for all desired fields in the top-level object.

The data structure being built is displayed in the left-side panel as elements are added. The data structure cannot be altered in this area. The display is for information only.

Create the Lower-Level DataBuilder Step(s)

These will be the next sections in the expected data structure. The process is the same as described in the “Main DataBuilder” step.

For objects such as a set of rows, the display will only display a single entry. However, all data received as input will be included when the workflow executes.

In most cases the lower-level sections will need to be marked as an array. The “Add as an array” checkbox should be selected. However, always check your API documentation to verify this.

All objects other than the main one will require an Object Name. This must exactly match (including case) what is expected by the API.

Reference Lower-level Objects in the Main DataBuilder Step

Once the DataBuilder steps for the lower-level objects have been created, they can be referenced in the main DataBuilder step. This is what causes the entire data structure to be created when the workflow is executed.

  1. Click the “Field Type” drop-down in the main DataBuilder step. The names of the lower-level objects are displayed in addition to the standard field type values.
  2. Select the desired object.
    1. The Field Name and Value are automatically filled in.
    2. The lower-level object is displayed in the left-side data structure.

Here is the resulting JSON that is sent in the API call.

{
"CardCode": "C20000",
"DocDueDate": "20190313",
"DocumentLines": [
{
"ItemCode": "A00001",
"Quantity": 9,
"LineTotal": 33.75
},
{
"ItemCode": "A00001",
"Quantity": 7,
"LineTotal": 105
}
],
"AddressExtension": [
{
"CItyB": "New York"
}
]
}

Reference the Output of the Main DataBuilder Step in the API Call

The output of the main DataBuilder step is used in the API call. This is done by using the “CumulativeData” variable from the Main DataBuilder step. An example is shown in the image below.

bw/databuilder_tool.1587588389.txt.gz · Last modified: 2020/04/22 16:46 by runger