TIBCO Scribe® Online Connector for Mapper Maps/Flows

TIBCO Scribe® Online Connector for Mapper Maps/Flows

book

Article ID: KB0074658

calendar_today

Updated On:

Products Versions
TIBCO Cloud Integration - Connect ( Scribe ) -

Description

Storing a variable (or state) of fields/values, multiple entities, and child records can be complex to design and even more difficult to maintain using out-of-the-box functions. In addition, you may want to store a JSON format of your data when using Connectors such as Files, HTTP, and Variables. Mapper can help you create a blueprint for your dataset, such as JSON, and provide the ability to get and set the entities and fields in that variable/state.

These simple Maps/flows attempt to demonstrate some concepts and how they can be achieved using the Mapper Connector. Review the Group Block labels in the flows that explain the purpose of the Blocks inside the Group.

To import and use the attached Sample Maps/flows, you must first install the Mapper Connector and configure the Mapper Connection.  The Mapper Connection configuration includes the names of the entities used in the Maps/flows as well as a JSON sample for each entity.  Configure the following three entities and copy/paste the associated JSON sample into the Mapper Connection dialog.

Entity: customer
Sample JSON for customer:

{
    "active":true,
    "id":"string",
    "integratedflag":"string",
    "region":"string",
    "xrefid":"string",
    "company" : {
        "name":"string",
        "number":"string",
        "fax":"string",
        "phone":"string",
        "primaryaddrname":"string"
    },
    "contact": {
        "name":"string",
        "title":"string",
        "email":"string"
    },
    "metadata":{
        "createdby":"string",
        "createdon":"string",
        "modifiedby":"string",
        "modifiedon":"string"
    },
    "finances": {
        "creditamount":10000,
        "creditonhold":true,
        "paymentterms":"string",
        "pricelist":"string"
    }
}

Entity: array_of_customer
Sample JSON for array_of_customer:
[
    {
        "active": true,
        "id": null,
        "integratedflag": null,
        "region": "North",
        "xrefid": null,
        "company": {
            "name": "Aberdeen Inc.",
            "number": "ABERDEEN0001",
            "fax": "(617) 832-9863",
            "phone": "(617) 832-7300",
            "primaryaddrname": "Main"
        },
        "contact": {
            "name": "Mr. Harold Michaelson",
            "title": "President",
            "email": null
        },
        "metadata": {
            "createdby": "SYSTEM_USER",
            "createdon": "2016-04-01 00:00:00",
            "modifiedby": "SYSTEM_USER",
            "modifiedon": "2016-04-07 11:07:43"
        },
        "finances": {
            "creditamount": 10000.0,
            "creditonhold": false,
            "paymentterms": "Net30",
            "pricelist": "Retail"
        }
    }
]

Entity: response_array_customer
Sample JSON for response_array_customer:
{
    "json": [
        {
            "active": true,
            "id": null,
            "integratedflag": null,
            "region": "North",
            "xrefid": null,
            "company": {
                "name": "Aberdeen Inc.",
                "number": "ABERDEEN0001",
                "fax": "(617) 832-9863",
                "phone": "(617) 832-7300",
                "primaryaddrname": "Main"
            },
            "contact": {
                "name": "Mr. Harold Michaelson",
                "title": "President",
                "email": null
            },
            "metadata": {
                "createdby": "SYSTEM_USER",
                "createdon": "2016-04-01 00:00:00",
                "modifiedby": "SYSTEM_USER",
                "modifiedon": "2016-04-07 11:07:43"
            },
            "finances": {
                "creditamount": 10000.0,
                "creditonhold": false,
                "paymentterms": "Net30",
                "pricelist": "Retail"
            }
        }
    ]
}

The Serialize and Deserialize (JSON) Map/flow demonstrates the following:
 
  • Starting a Map/flow with no source data for the Query Block.
  • Using a Fetch Block to retrieve Account records from a Sample CRM database.
  • Serializing an Account record input to output JSON. The customer entity in the Serialize Block uses the customer entity JSON sample configured on the Mapper Connection dialog to determine how to map the Account record fields to a JSON format. The objects on the Serialize Block Properties Include tab represent how TIBCO Scribe® Online / TIBCO Cloud™ Integration - Connect interprets the objects in the JSON sample.
  • Writing the results to the Agent log.
  • Using an Upsert Block to create a variable that stores the JSON so it can be used later in the Map/flow since Fetch Block results cannot be accessed outside of the Fetch Block.
  • Using a Loop Exit Block to exit the Fetch Block. This forces the Fetch Block to only process one record at a time instead of all of the records returned by the Fetch. The Map/flow can then process the record stored in the variable before processing any additional Account records.
  • Using a Lookup Block to retrieve the customer record from the variable.
  • Using a Fetch Block to deserialize the JSON. The Filter tab captures the JSON returned from the variable retrieved in the previous Block and deserializes it based on the sample JSON in the Mapper connection dialog.
  • Using an Execute Block to write the response to the Agent log.


The Working with Arrays Map/flow demonstrates the following:

When configuring sample JSON in the Mapper Connection dialog, the square brackets [ ] indicate that the sample is an array. The top level of this array corresponds to the object labeled Anonymous in the Include tab of the Serialize and Fetch Blocks. To reveal and access the objects within the array, you must select the Anonymous object on the Include tab. The Include tab displays the format of the JSON as TIBCO Scribe® Online / TIBCO Cloud™ Integration - Connect interprets it.

  • Starting a flow with no source data for the Query Block.
  • Using the Serialize Block to establish the format of the array_of_customer JSON output by selecting the objects on the Include tab. Errors display because there are no fields mapped on the fields tab, but for this scenario no field mappings are required.
  • Using a Fetch Block to retrieve Account records from a Sample CRM database.
  • Using an Add Block to map Account fields to the correct array_of_custoomer JSON objects and add each customer record into the array.
  • Using an Execute Block to write the output to the Agent log.
  • Using a Fetch Block to deserialize the JSON. The mapper_input field on the Filter tab captures the JSON output generated by the Serialize Block and deserializes it based on the sample JSON in the Mapper Connection dialog.
  • Using the For Each Child Block to retrieve one customer record at a time from the deserialized JSON.
  • Using an Execute Block to write a message for each record to the Agent log.


The Working with HTTP Map/flow is a more complete scenario and demonstrates the following:

  • Starting a Map/flow with no source data for the Query Block.
  • Using the Serialize Block to establish the format of the array_of_cusotmer JSON output by selecting the objects on the Include tab. Errors display because there are no fields mapped on the fields tab, but for this scenario no field mappings are required.
  • Using a Fetch Block to retrieve Account records from a Sample CRM database.
  • Using an Add Block to map Account fields to the correct JSON objects and add each Account record into the array.
  • Using a Send Block with the POST HTTP verb to send the JSON array in an HTTP request. This Block uses Postman Echo to echo the HTTP request back to TIBCO Scribe® Online / TIBCO Cloud™ Integration - Connect.
  • Using a Fetch Block to deserialize the JSON in the HTTP response. The mapper_input field on the Filter tab captures the JSON response from the Send POST Block and deserializes it based on the sample JSON in the Mapper Connection dialog.
  • Using the For Each Child Block to retrieve one customer record at a time from the deserialized JSON.
  • Using an Execute Block to write a message for each record to the Agent log.


Scribe Online Classic Users
For more information on prerequisites, importing the Maps, and using the Files Connector, see Connector Extensions and Mapper Connector.

TIBCO Cloud Integration - Connect Users
For more information on prerequisites, importing the flows, and using the Files Connector, see Connector Extensions and Mapper Connector.

DISCLAIMER

 

Copyright (c) 2020, TIBCO Software Inc. All rights reserved.

 

No Support. You acknowledge that TIBCO will not provide any maintenance or support for this software. You have no right to receive any upgrades, patches, enhancements, bug fixes, new versions or new releases of the software.

 

Internal Use Only License Grant. TIBCO hereby grants you a limited, non‐transferable, non‐exclusive license to use the software solely for your internal business purposes. The name of TIBCO Software Inc. may not be used to endorse or promote products derived from this software without specific prior written permission of TIBCO Software Inc.

 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT OWNERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  

Issue/Introduction

Use the attached Sample Maps/Flows to familiarize yourself with using the Mapper Connector Extension.

Attachments

TIBCO Scribe® Online Connector for Mapper Maps/Flows get_app