multiple output loops generating incorrect xml

One Star

multiple output loops generating incorrect xml

Hi can someone please comment on the following as I am certain there is quite a trivial mistake on my behalf.
I only expect the scNumber lookup to trigger twice and the smsisdn lookup to trigger once.
The image above has been executed twice.
<tnsSmiley Tonguerofile>
<tns:ConnectID/>
<tns:CustomerNumber>9999999999</tns:CustomerNumber>
<tns:AccountNumber>99999999999</tns:AccountNumber>
<tnsSmiley TonguerimaryMSISDN/>
<tns:Currency>ZAR</tns:Currency>
<tns:Balance>78.0</tns:Balance>
<tns:CreditLimit>0.0</tns:CreditLimit>
<tns:Country>South_Africa</tns:Country>
<tns:IBSDSN>South_Africa_QA</tns:IBSDSN>
<tns:HasDebitOrder>false</tns:HasDebitOrder>
<tnsSmiley FrustratedecondaryMSISDNs>
<tns:MSISDN>2773999999</tns:MSISDN>
<tns:MSISDN>2773999999</tns:MSISDN> <------ This element should not be present. It is a repetition of the previous one.
</tnsSmiley FrustratedecondaryMSISDNs> There is only one entry in the table
<tnsSmiley FrustratedmartCardNumbers>
<tnsSmiley FrustratedmartCard>4123609798</tnsSmiley FrustratedmartCard>
<tnsSmiley FrustratedmartCard>4138196846</tnsSmiley FrustratedmartCard>
</tnsSmiley FrustratedmartCardNumbers>
</tnsSmiley Tonguerofile>
NOTE: I have changed the actual values for security reasons
I cannot set the group element on the <tnsSmiley FrustratedecondaryMSISDNs> or <tnsSmiley FrustratedmartCardNumbers> nodes.
Am i correct in thinking that the above edges will always fire equally?
This particular operation starts with the parent table and gets all related child entries. I am expected to also start from one of the child tables and get the related parent as well as the related siblings in two other operations.

Regards,
Graham
One Star

Re: multiple output loops generating incorrect xml

Ok I have done some investigation and it seems the component i should be using to produce XML from a database is the tWriteXMLField
Can someone please confirm this.
My database structure is as follows
Customer
-----------
ID sequence
field2
field3

SmartCard
-------------
CustomerProfileID is a foreign key referencing Customer.ID
smartCardNumber
SecondaryMSISDN
----------------------
CustomerProfileID is a foreign key referencing Customer.ID
MSISDN

ER Diagram of the above data structure would thus be
*
----------- SecondaryMSISDN
* /
Customer
1 \
------------ SmartCard
*
The many to many relation above is not used in this post however will only be used in an operation getProfileByMSISDN
I will cross that bridge when i get there...
This should produce the following xml. This is conceptual as in one operation I must only retrieve one Profile, in another n profiles.
An EXTRACT of the actual schema is pasted below.
<profiles>
<profile>
<smsisdnCollection>
<msisdn>1</msisdn>
<msisdn>n</msisdn>
</smsisdnCollection>
<smartCardCollection>
<smartCard>1</smartCard>
<smartCard>n</smartCard>
</smartCardCollection>
</profile>
</profiles>
<xsd:complexType name="Profile">
<xsd:sequence>
<xsd:element name="ConnectID" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="CustomerNumber" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="AccountNumber" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="PrimaryMSISDN" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="Currency" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="Balance" type="xsd:float" minOccurs="0" maxOccurs="1" />
<xsd:element name="CreditLimit" type="xsd:float" minOccurs="0" maxOccurs="1" />
<xsd:element name="Country" type="dstv:CountryName" minOccurs="0" maxOccurs="1" />
<xsd:element name="IBSDSN" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="HasDebitOrder" type="xsd:boolean" minOccurs="0" maxOccurs="1" />
<xsd:element name="SecondaryMSISDNs">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MSISDN" type="xsd:string" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SmartCardNumbers">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="SmartCard" type="xsd:string" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="GetProfileByMSISDNResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Profiles">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Profile" type="tns:Profile" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetProfileByCustomerNumberResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" nillable="true" name="Profile" type="tns:Profile" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>

I am certain this should be quite trivial in Talend!!! What am i missing Smiley Sad

Thanks in advance
Graham
One Star

Re: multiple output loops generating incorrect xml

Please, please, please....
If you know the solution can you assist me here. The heat on my back is getting unbearable.
Seventeen Stars

Re: multiple output loops generating incorrect xml

hi gaimmo,
seem your have to use "multi schema output " allowing to loop & group fields for output.
have a look at :

https://help.talend.com/search/all?query=tFileOutputMSXML&content-lang=en
another good ressource :
http://bekwam.blogspot.fr/2011/09/xml-output-from-multiple-data-sources.html


regards
laurent
One Star

Re: multiple output loops generating incorrect xml

Hi kzone, I had a look at the article on bekwam. I didnt like the fact that the solution used files to resolve the problem. The operation I am designing will get hammered and I felt that this would slow the operation to much however as it is to date the only solution i have i will go with it. Furthermore it seems to be outdated as it was prior to the release of tXMLMap.
Thanks again
Graham
One Star

Re: multiple output loops generating incorrect xml

Smiley Sad if anyone knows how to do this in a tXMLMap please reply I would truly appreciate a constructive comment on this...
Four Stars

Re: multiple output loops generating incorrect xml

Some help in reading multi-schema XML files with nested loops - http://goo.gl/CqD39w
Writing multi-schema XML files with nested loops - http://www.talendforge.org/forum/viewtopic.php?pid=129892#p129892
One Star

Re: multiple output loops generating incorrect xml

I had a look at your tutorial. It is not quite the same as my problem.
I am constructing an xml response.
I only want one iteration on the output line with the entire xml document.
I solved it by writing my own xml parser...