cancel
Showing results for 
Search instead for 
Did you mean: 

NEED HELP IN MAPPING

Former Member
0 Kudos

Dear experts

Iam getting multiple shipment items from source.I need to populate in the following way in the target.

In the target structure i have sub node document data under which two attributes are defined. I need to populate the attributes with following way

name with field name  and the value with value coming from the source for that field.

Please find the attached target output expected and help me on this asap.

Regards

Nagur

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member190293
Active Contributor
0 Kudos

Hi Nagur!

I guess XSLT transformation would be the one of the decisions in your case.

Something like this:

Source:

<?xml version="1.0" encoding="UTF-8"?>

<ns1:MT_Customers xmlns:ns1="urn:jdbc_connect">

     <Customer>

          <CustomerID>105</CustomerID>

          <CustomerName>Item 105</CustomerName>

     </Customer>

     <Customer>

          <CustomerID>106</CustomerID>

          <CustomerName>Item 106</CustomerName>

     </Customer>

     <Customer>

          <CustomerID>107</CustomerID>

          <CustomerName>Item 107</CustomerName>

     </Customer>

     <Customer>

          <CustomerID>108</CustomerID>

          <CustomerName>Item 108</CustomerName>

     </Customer>

     <Customer>

          <CustomerID>109</CustomerID>

          <CustomerName>Item 109</CustomerName>

     </Customer>

</ns1:MT_Customers>

XSL transformation:

<?xml version='1.0'?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

  <Output_Message>

  <xsl:apply-templates select="//Customer"/>

  </Output_Message>

</xsl:template>

<xsl:template match="Customer">

  <DocumentData>

  <xsl:for-each select="./*">

  <xsl:attribute name="{local-name()}">

  <xsl:value-of select="text()"/>

  </xsl:attribute>

  </xsl:for-each>

  </DocumentData>

</xsl:template>

</xsl:stylesheet>

Result:

<?xml version='1.0' ?>

<Output_Message>

     <DocumentData CustomerID="105" CustomerName="Item 105"/>

     <DocumentData CustomerID="106" CustomerName="Item 106"/>

     <DocumentData CustomerID="107" CustomerName="Item 107"/>

     <DocumentData CustomerID="108" CustomerName="Item 108"/>

     <DocumentData CustomerID="109" CustomerName="Item 109"/>

</Output_Message>

Regards, Evgeniy.

luisbarros
Participant
0 Kudos

Hello Nagur,

I'm not aware of a standard PI function to get the name of the source field.

So create a destination structure with multiple "node-name / value" pairs. Then in your mapping you would have to manually set the node names and map the corresponding node to the value.

Regards,

Luis

Former Member
0 Kudos

Can you help me how to do this.

Regards

Nagur

former_member186851
Active Contributor
0 Kudos


Hello Nagur,

All these values are Coming from input payload.

Why dont you map actual values to node and attribute and check.

Former Member
0 Kudos

Hi Raghu

I have only one node at the target with occurance as 1 to 1

Regards

Nagur

Former Member
0 Kudos

I want the field name to be populated in the target.for the attribute name.

Regards

Nagur

manoj_khavatkopp
Active Contributor
0 Kudos

Map the target attribute filed with constant as the source field name as Luis suggested.

former_member186851
Active Contributor
0 Kudos

Hello Nagur.

Try like below.

Map the incoming value to value,Constant value to the name.

And you can duplicate the node or create many as Luis and Manoj suggested.