#1 2012-06-06 05:36:00

mkeyes
Member
Registered: 2010-10-07
Posts: 12

One to many foreign key in a tReceive

Tags: [MDM, tRecieve, xml]

I've got a tReceive in a job I'm using to update a database from MDM. The data model has a one to many relationship within it, the update looks like the below. How do I extract the VendorBrandName values ([3] and [20])? I'd like to get a flow out of this with two rows that look like this:

id    Brand                   VendorBrandName
3     TheBrandName           3
3     TheBrandName           20


Here is the update XML:

<exchange xmlns:mdm="java:com.amalto.core.plugin.base.xslt.MdmExtension">
   <report>
      <Update>
         <UserName>administrator</UserName>
         <Source>genericUI</Source>
         <TimeInMillis>1338934965937</TimeInMillis>
         <RevisionID>null</RevisionID>
         <DataCluster>My_Container</DataCluster>
         <DataModel>Brand</DataModel>
         <Concept>Brand</Concept>
         <Key>3</Key>
         <Item>
            <path>VendorBrandName[2]</path>
            <oldValue/>
            <newValue>[20]</newValue>
         </Item>
         <OperationType>UPDATE</OperationType>
      </Update>
   </report>
   <item><Brand><id>3</id><BrandName>TheBrandName</BrandName><VendorBrandName>[3]</VendorBrandName><VendorBrandName>[20]</VendorBrandName></Brand></item>
</exchange>

Thanks in advance for any hints!

Offline

 

#2 2012-06-11 20:35:03

vgalopin
Talend team
Registered: 2009-04-15
Posts: 440
Website

Re: One to many foreign key in a tReceive

Hi,

You will need to put the Loop Element on the VendorBrandName, as it's the one that has the One to Many relationship.
/exchange/item/VendorBrandName

Then to extract all your field just use Xpath.

ID --->                                   ../id
BrandName --->                      ../BrandName
VendorName ---->                   .


Vincent Galopin
US Pre-Sales Consultant
Talend US

Offline

 

#3 2012-07-18 03:51:32

mkeyes
Member
Registered: 2010-10-07
Posts: 12

Re: One to many foreign key in a tReceive

Thanks, Vincent that works perfectly!

Offline

 

Board footer

Powered by FluxBB