cancel
Showing results for 
Search instead for 
Did you mean: 

Flat file to hierarchy target mapping

mohammadaamir_khan
Participant
0 Kudos
185

Hi,

I am using PI 7.4 and using graphical mapping.

My source is a flat file which I have map it to a hierarchical output based on line number value.

Basically DocumentLineNumber can be repeated based on LotNumber values.

INPUT

<row>
<DocumentNumber>11</DocumentNumber>
<DocumentLineNumber>10</DocumentLineNumber>
<ItemNumber>MAT-123</ItemNumber>
<LotNumber>lot1</LotNumber>
<TransactionQuantity>1</TransactionQuantity>
</row>
<row>
<DocumentNumber>11</DocumentNumber>
<DocumentLineNumber>10</DocumentLineNumber>
<ItemNumber>MAT-123</ItemNumber>
<LotNumber>lot2</LotNumber>
<TransactionQuantity>2</TransactionQuantity>
</row>
<row>
<DocumentNumber>11</DocumentNumber>
<DocumentLineNumber>20</DocumentLineNumber>
<ItemNumber>MAT-343</ItemNumber>
<LotNumber>lot3</LotNumber>
<TransactionQuantity>5</TransactionQuantity>
</row>
<row>
<DocumentNumber>11</DocumentNumber>
<DocumentLineNumber>30</DocumentLineNumber>
<ItemNumber>MAT-742</ItemNumber>
<LotNumber>lot4</LotNumber>
<TransactionQuantity>4</TransactionQuantity>
</row>

Desired Output

 <Request>
      <DocumentNumber>11</DocumentNumber>
      <lines>        
         <DocumentLineNumber>10</DocumentLineNumber>
         <ItemNumber>MAT-123</ItemNumber>
         <lotItemLots>
            <LotNumber>lot1</LotNumber>
    <TransactionQuantity>1</TransactionQuantity>
         </lotItemLots>
         <lotItemLots>
            <LotNumber>lot2</LotNumber>
    <TransactionQuantity>2</TransactionQuantity>
         </lotItemLots>
       </lines>
 
       <lines>        
         <DocumentLineNumber>20</DocumentLineNumber>
         <ItemNumber>MAT-343</ItemNumber>
         <lotItemLots>
            <LotNumber>lot3</LotNumber>
    <TransactionQuantity>5</TransactionQuantity>
         </lotItemLots>
       </lines>
 
       <lines>        
         <DocumentLineNumber>30</DocumentLineNumber>
         <ItemNumber>MAT-742</ItemNumber>
         <lotItemLots>
            <LotNumber>lot4</LotNumber>
            <TransactionQuantity>4</TransactionQuantity>
         </lotItemLots>
       </lines>
   </Request>
 
How do we convert this in graphical mapping?
Thanks

 

View Entire Topic
Ryan-Crosby
Active Contributor
0 Kudos

Here are a bunch of screen shots showing the individual target fields with a combination of sorting, collapsing contexts and splitting by values (some by each value and others by value change, which I would leave to you to figure out), and one use of formatByExample, along with a screenshot of the result in CPI (I don't have PI/PO anymore).

Screenshot 2024-10-25 at 10.19.59.pngScreenshot 2024-10-25 at 10.20.18.pngScreenshot 2024-10-25 at 10.20.30.pngScreenshot 2024-10-25 at 10.20.37.pngScreenshot 2024-10-25 at 10.20.48.pngScreenshot 2024-10-25 at 10.20.54.pngScreenshot 2024-10-25 at 10.19.41.png

 

Regards,

Ryan Crosby