Requirement in XML stage in Datastage 8.5

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ragavendradineshdsx
Participant
Posts: 15
Joined: Sat Nov 14, 2009 3:38 am

Requirement in XML stage in Datastage 8.5

Post by ragavendradineshdsx »

Hi all,

I have a unique requirement in the new XML stage in Datastage 8.5. Let me give you a sample XSD file below.

----------------------------------------------------------------------------------
<xs:element name="ContactInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="ContactType" type="xs:string"/>
<xs:element name="TypeValue" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="Employee">
<xs:complexType>
<xs:sequence>
<xs:element name="EmployeeID" type="xs:string"/>
<xs:element ref="ContactInfo"/>
</xs:sequence>
</xs:complexType>
</xs:element>

----------------------------------------------------------------------------------

In the XSD, "Employee" is my root element and under employee node, we have "ContactInfo" as one of the child node. This ContacInfo element can have 2 sub-nodes
"ContactType" and "TypeValue". Let me come to the issue. As per my requirement, there are 2 types of values possible for "ContactInfo". Either it can be "Telephone" related information
or it can be "Email" related informations. For eg --> an employee can have both the informations as well. In that case, I need to get 2 seperate tags in the XML.
I will give a fair idea of how my source would look like.


Input row:

EmployeeID||ContactTypeTelephone||TypeValueTelephone||ContactTypeEmail||TypeValueEmail
0001||Mobile||9XXXXX 9XXXXX||PersonalEmail||aaa@email.com
0001||Pager||12XXXX ||NULL||NULL


My Output should be:

<Employee>
<EmployeeID>0001</EmployeeID>
<ContactInfo>
<ContactType>Mobile</ContactType>
<TypeValue>9XXXXX 9XXXXX</TypeValue>
</ContactInfo>
<ContactInfo>
<ContactType>Pager</ContactType>
<TypeValue>12XXX</TypeValue>
</ContactInfo>
<ContactInfo>
<ContactType>PersonalEmail</ContactType>
<TypeValue>aaa@email.com</TypeValue>
</ContactInfo>
</Employee>


I'm able to achive the output only for Mobile and Pager but i'm not able to include EMAIL in my XML output.
I'm using "Re-Group" step and "XML Composer" steps in my XML stage. Please help me out to achive this output.
Thanks & Regards,
Ragavendra Dinesh C
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Try pivoting it first so that the number of rows in the incoming link "list" is the same as the number of nodes you want in your target "list". (ie..get email onto its own row)

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply