Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Add question

You must login to ask question.

Login

Register Now

APPSeCONNECT community provides a new way for integration super heros connect the external world. Join hands together to build a community of people to help each other, solve problems or share knowledge.

How to handle Custom Complex Transformation in APPSeCONNECT

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

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

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 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 same name and hence make it very much difficult to create a schema definition of a column field. Here comes the utility of a custom Renderer.

In 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 which 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 straight forward mapping.

 

I hope this post will help you using the feature.

Thanks.

About Abhishek SurVerifiedExpert

VP, Products at InSync Abhishek Sur has been a Microsoft MVP since 2011. He is currently working as a Product Head with Insync Tech-Fin Solutions Pvt Ltd. He has profound theoretical insight and years of hands-on experience in different .NET products and languages. Over the years, he has helped developers throughout the world with his experience and knowledge. He owns a Microsoft User Group in Kolkata named Kolkata Geeks and regularly organizes events and seminars in various places to spread .NET awareness. A renowned public speaker, voracious reader, and technology buff, Abhishek's main interest lies in exploring the new realms of .NET technology and coming up with priceless write-ups on the unexplored domains of .NET. He is associated with Microsoft's Insider list on WPF and C# and stays in touch with Product Group teams. He holds a Master's degree in Computer Application along with various other certificates to his credit. Abhishek is a freelance content producer, developer, and site administrator. His website www.abhisheksur.com guides both budding and experienced developers in understanding the details of languages and latest technologies. He has a huge fan following on social networks. You can reach him at books@abhisheksur.com, get online updates from his Facebook account, or follow him on Twitter @abhi2434.

Follow Me

Leave a reply

Share via
Copy link
Powered by Social Snap