This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
bw2:databuilder_tool [2020/12/15 12:37] akoehler |
bw2:databuilder_tool [2022/08/02 15:33] (current) akoehler |
||
|---|---|---|---|
| Line 11: | Line 11: | ||
| ====== Before You Begin ====== | ====== 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. | + | You will need to know, or have examples of, the data structures the API is expecting. This includes |
| - | ====For SAP Business One Service Layer==== | + | =====For SAP Business One Service Layer===== |
| - | An easy way to view the data structures used for SAP Business One is to create a small workflow that executes a GET on the object in question. | + | An easy way to view the data structures used for SAP Business One is to create a small workflow that executes a GET on the object in question. |
| + | More information dealing with SAP Service Layer can be found **[[bw2: | ||
| ====== General Notes ====== | ====== General Notes ====== | ||
| - Input will generally be from a SQL Reader step. | - Input will generally be from a SQL Reader step. | ||
| - | - The example used in this page is for JSON. The same general process is also used for XML. | + | - The example used on this page is for JSON. The same general process is also used for XML. |
| + | - When working with decisions, the Databuilder tool in a branch of a decision will only reference Databuilder tools in that same branch. | ||
| ====== General Process ====== | ====== General Process ====== | ||
| Line 25: | Line 27: | ||
| - Create an input (SQL Reader) step for each dataset that will be needed. An example would be order header and order lines. | - Create an input (SQL Reader) step for each dataset that will be needed. An example would be order header and order lines. | ||
| - Create a DataBuilder step for each dataset. | - Create a DataBuilder step for each dataset. | ||
| - | - Once all DataBuilder steps are created, add the lower-level datasets to the main dataset. | + | - Once all DataBuilder steps are created, add the lower-level datasets to the main dataset. |
| - | - The “CumulativeData” variable from the main DataBuilder step in referenced in the web service step that transmits the information | + | - The “CumulativeData” variable from the main DataBuilder step is referenced in the web service step that transmits the API' |
| - | ====== Sample Building JSON for SAP Business One Service Layer ====== | + | ====Databuilder==== |
| + | {{ : | ||
| - | ===== Workflow ===== | + | - **Tool Name:** This is the name given to the tool. This will be displayed in the design canvas as well as the variable selector |
| - | This workflow builds two sections | + | - **Description: |
| + | - **DataSource Object: | ||
| + | - This is required and is always a SQL/HANA tool. | ||
| + | - **Hint** the number of rows you feed into the databuilder from the subsequent SQL step determines the number of sections | ||
| + | - **Data Type:** This determines the type of file that is generated. | ||
| + | - **Add as an Array:** this will add an array to your JSON or XML. | ||
| + | - Arrays will be displayed in the Field Type drop-down | ||
| + | - If selected, it will insert | ||
| + | - **Top-Level Element:** This clears | ||
| + | - This is generally used to update one thing at a time. If the API used can be updated with one large JSON or XML file, this option can be un-selected. | ||
| + | - **Create New Object:** The Object name of the JSON or XML structure. | ||
| + | - This can be used to create multiple levels of XML or JSON (see example below) | ||
| + | - **Preview Box:** A preview of the JSON or XML that is being built. | ||
| + | - **Name-Value Pair:** | ||
| + | - **Field Name:** The name of the name-value pair | ||
| + | - **Field Type:** This can either be String, Numeric, Boolean, or an Array built later in the workflow. | ||
| + | - **Value:** Normally a variable from the connected SQL/ | ||
| + | - **Add Row or Delete:** {{: | ||
| - | {{ : | ||
| - | ===== Create Main DataBuilder Step ===== | + | ======JSON Example====== |
| + | Below is an example of how to build a basic JSON File. The data is coming from SAP but this concept applies to any API being used to pass data to. | ||
| + | {{ : | ||
| - | {{: | + | * Start by getting all the data needed and process that through a loop as we only want to process one record at a time in this example. |
| + | * **Note** Most APIs are case-sensitive. | ||
| + | * Once the data is sent into the loop you will limit it down to one record and add link it to the next step which is the data builder step | ||
| + | * Note Top-Level Element is selected. In this example, we are adding one record at a time | ||
| - | This should always contain the first items of the data structure. | + | {{ :bw2:bizweaverdatabuilder4.png |}} |
| - | + | ||
| - | - Enter a workflow step name. | + | |
| - | - Select the data source from the Datasource Object drop-down list. | + | |
| - | - Select the desired data structure type to be created (JSON or XML). | + | |
| - | - Leave the “Add as an array” checkbox cleared unless you know that the top-level object needs to be any array. This is uncommon. | + | |
| - | - Select the " | + | |
| - | - This option causes the " | + | |
| - | - Enter the name of the top-level object. | + | |
| - | - The requirements of the receiving API will determine this. | + | |
| - | - In some cases, a top-level object name is not used; e.g. SAP Service Layer and BigCommerce. | + | |
| - | - If a top-level object name is not used, leave the field blank. | + | |
| - | - Create a row for each value to be included in the structure. | + | |
| - | - Enter the output field name values in the right-side grid. | + | |
| - | - The Field Name value will need to exactly match (including case) the value the API is expecting. | + | |
| - | - Select the field type from the drop-down list. | + | |
| - | - Press < | + | |
| - | + | ||
| - | 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) ===== | + | |
| - | + | ||
| - | {{ :bw:databuilder3.png? | + | |
| - | + | ||
| - | This will be the next section 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. | + | |
| <WRAP center round tip 80%> | <WRAP center round tip 80%> | ||
| Line 79: | Line 73: | ||
| </ | </ | ||
| + | * Once the data is mapped add another loop to process all lines. This will be built as an array. The Create New Object is filled in as it is needed to identify the array. | ||
| + | {{ : | ||
| - | All objects other than the main one will require an Object Name. This must exactly match (including case) what is expected by the API. | + | * Once the lines data builder |
| - | + | ||
| - | ===== 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 | + | |
| - | + | ||
| - | - Click the “Field Type” drop-down in the main DataBuilder | + | |
| - | - Select | + | |
| - | - The Field Name and Value are automatically filled in. | + | |
| - | - The lower-level object is displayed in the left-side | + | |
| - | + | ||
| - | {{ : | + | |
| - | Here is the resulting JSON that is sent in the API call. | + | {{ : |
| - | <code json> | + | * Once the JSON is built it the Cumulative data variable from the Header step can be used and entered into the body section of a Web Service 2 tool to then be sent through |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | ], | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | } | + | |
| - | ] | + | |
| - | } | + | |
| - | </ | + | |
| - | ===== Reference | + | |
| - | 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. | + | {{ : |
| - | {{ : | ||
| + | ====Databuilder Variables==== | ||
| + | ^Name ^ Description | ||
| + | |AddAsArry|True or False if the add as array checkbox is selected| | ||
| + | |CumulativeData|This is the collection of all data that was built in the databuilder| | ||
| + | |Data|This is the last run of data that was entered into the databuilder| | ||
| + | |DataSourceName|This indicates the name of the tool that is being used for the source data for the databuilder| | ||
| + | |DataType|This indicates the type of data your are building XML or JSON| | ||
| + | |ObjectName|Is the name of the top level of your JSON or XML| | ||
| + | |TopLevelElement|True or False if the top level element checkbox is selected| | ||
| + | | StepMessage|During a failure the reason for failure will be populated here | | ||
| + | | StepStatus | ||