Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.
<tns 0683p000009MAB6.pngrofile>
<tns:ConnectID/>
<tns:CustomerNumber>9999999999</tns:CustomerNumber>
<tns:AccountNumber>99999999999</tns:AccountNumber>
<tns 0683p000009MAB6.pngrimaryMSISDN/>
<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>
<tns 0683p000009M9p6.pngecondaryMSISDNs>
<tns:MSISDN>2773999999</tns:MSISDN>
<tns:MSISDN>2773999999</tns:MSISDN> <------ This element should not be present. It is a repetition of the previous one.
</tns 0683p000009M9p6.pngecondaryMSISDNs> There is only one entry in the table
<tns 0683p000009M9p6.pngmartCardNumbers>
<tns 0683p000009M9p6.pngmartCard>4123609798</tns 0683p000009M9p6.pngmartCard>
<tns 0683p000009M9p6.pngmartCard>4138196846</tns 0683p000009M9p6.pngmartCard>
</tns 0683p000009M9p6.pngmartCardNumbers>
</tns 0683p000009MAB6.pngrofile>
NOTE: I have changed the actual values for security reasons
I cannot set the group element on the <tns 0683p000009M9p6.pngecondaryMSISDNs> or <tns 0683p000009M9p6.pngmartCardNumbers> 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
0683p000009MEiY.png 0683p000009MEuE.png
Labels (2)
7 Replies
Anonymous
Not applicable
Author

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 0683p000009MPcz.png

Thanks in advance
Graham
Anonymous
Not applicable
Author

Please, please, please....
If you know the solution can you assist me here. The heat on my back is getting unbearable.
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

0683p000009MPcz.png if anyone knows how to do this in a tXMLMap please reply I would truly appreciate a constructive comment on this...
willm1
Creator
Creator

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
Anonymous
Not applicable
Author

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...