How to Handle Custom Complex Transformation in APPSeCONNECT

How to Handle Custom Complex Transformation in APPSeCONNECT

How-to-handle-Custom-Complex-Transformation-in-APPSeCONNECT

Transformation is a technique to change the format of one XML packet to another. In the case of transformation, we generally consider two types of structure, we call it a Schema. A schema is an XML hierarchy that lets you define an XML document of the data coming from an application or a data source.

In APPSeCONNECT, we transform data coming from one application to another using a Transformation block called Mapper. In ProcessFlow, we drag a mapper and connect two actions that lead to the creation of the transformation script.

Handling Custom Complex Transformation in APPSeCONNECT

Now let us take an example of an XML Document.

(We take this document as simple as possible to ensure we understand the transformation better. )

<customers>
<customer>
<Name>Abhishek</Name>
<Age>30</Age>
<Addresses>
<Address type="Business">
<FlNo>17</FlNo>
<Street>Main Street</Street>
<ZipCode>83888</ZipCode>
<Country>India</Country>
</Address>
<Address type="Personal">
<FlNo>16</FlNo>
<Street>Linkcoln Sarani</Street>
<ZipCode>83888</ZipCode>
<Country>India</Country>
</Address>
</Addresses>
<email>abhishek@abhisheksur.com</email>
</customer>
<customer>
<Name>Samar</Name>
<Age>30</Age>
<Addresses>
<Address type="Personal">
<FlNo>40</FlNo>
<Street>Woodland Lane</Street>
<ZipCode>83888</ZipCode>
<Country>India</Country>
</Address>
</Addresses>
<email>samar@abhisheksur.com</email>
</customer>
</customers>

Now here in the XML document, we have two data one for Abhishek and another for Samar. The data Abhishek contains two addressees while Samar is having one address. If we consider the schema to map this document, we do it like the one below :

customer schema

Hence it is clear, that the schema needs to be defined correctly to map the elements of an XML. Now as you know the work of the transformation is to transform the data based on the output schema defined on the other application. In certain scenario, let’s say if it is CSV or XLS or any other API which does not have the concrete schema defined, there might be a case where an unusual data format needs to be produced. For instance, let us suppose the output we require to generate is something like the one below:

<Data>
<row>
<column Name="Name" value="Abhishek"></column>
<column Name="Age" value="30"></column>
<column Name="Email" value="abhishek@abhisheksur.com"></column>
<column Name="Address">
<row>
<column Name="FLNo" value="17"></column>
<column Name="Street" value="Main Street"></column>
<column Name="ZipCode" value="83888"></column>
<column Name="Country" value="India"></column>
</row>
</column>
</row>
<row>
<column Name="Name" value="Samar"></column>
<column Name="Age" value="30"></column>
<column Name="Email" value="samar@abhisheksur.com"></column>
<column Name="Address">
<row>
<column Name="FLNo" value="40"></column>
<column Name="Street" value="Woodland Lane"></column>
<column Name="ZipCode" value="83888"></column>
<column Name="Country" value="India"></column>
</row>
</column>
</row>
</Data>

Now, this data structure is completely different, and you cannot create a valid schema out of the same. Now logically every data is inside the column of the same name and hence makes it very much difficult to create a schema definition of a column field. Here comes the utility of a Custom Renderer.

In the case of Custom Renderer, we allow users to use a schema as concrete as possible, but we change the rendering engine a bit such that the rendering gives you a different output.

Let us consider the schema again

customer schema

This same schema could be used to again generate the output XML. We map the fields one to one, and we rely on our renderer to specify the rendering type.

custom renderer

Now here we have defined a custom renderer in the mapping to ensure the rendering does not follow the default rendering technique which is <field>value</field>. We have just changed the way each row will be going to be rendered and the rendering of each row will be like the one defined above.

Now during mapping, if you just say
using the renderer

Here the email will use the custom renderer rather than the default rendering technique.

Conclusion

In APPSeCONNECT we always want to have better visibility of data transformation, and hence we came up with a feature that can help in developing the mapping inside an integration easier even though the output of a rendering looks ugly. The custom rendering allows you to specify a custom rendering in an application from a straightforward mapping.

I hope this post will help you using the feature.

Thanks.

Abhishek Sur

Abhishek Sur is the VP of Product in APPSeCONNECT. He is an architect of the product and a developer by passion.

Our integrations are dynamic in nature. The mentioned offerings are the cumulative possibilities of the platform (actual scenarios are specifically organization/business-dependent). For any disparity, please refer to the latest version of the integration brochures.