One Star

[resolved] MSXML processing different loops problem

Hi all,
I need to convert XML file with 2 different loops on the same level. I've tried to use tFileInputMSXML and tFileOutputMSXML for it. I was able to get all required data using tFileInputMSXML, but I couldn't connect different tFileInputMSXML outputs to single tFileOutputMSXML.
I have following input xml structure:
<getPropertyDescResult>
<clsProperty>
<strPropId>0171</strPropId>
<strName>Key 0171 Warm Sands Cool Water</strName>
...other general properties...
<arrPicList>
<clsPictureInfo>
<strURL>http://secure.......jpg</strURL>
<intWidth>288</intWidth>
<intHeight>216</intHeight>
<blnHasLargeImage>false</blnHasLargeImage>
</clsPictureInfo>
....other images....
</arrPicList>
<arrSeasonRates>
<clsSeasonRates>
<strChargeBasis>Daily</strChargeBasis>
<dtBeginDate>2013-01-01T00:00:00</dtBeginDate>
<dtEndDate>2013-03-16T00:00:00</dtEndDate>
<dblRate>270</dblRate>
</clsSeasonRates>
....other rates....
</arrSeasonRates>
</clsProperty>
</getPropertyDescResult>
and I want to get similar output xml.
Could you explain me hoe could I put results of these 3 schema to single XML output file ?
I've attached pictures with tFileInputMSXML and testing job.
5 REPLIES
Community Manager

Re: [resolved] MSXML processing different loops problem

Hi
You are not allowed to create a Job with multiple paths from a single source to the same target, see
https://community.talend.com/t5/Design-and-Development/Can-I-create-a-Job-with-multiple-paths-from-a...
In this case, you can store the result into a temporary file or memory with tHashOutput file first. In next subjob, using tFileInputDelimited or tHashInput to read back the data from a file or memory. For example:
tFileInputMSXML---row1--tHashOutput_1
---row2---tHashOutput_2
---row3---tHashOutput_3
|
onsubjobok
|
tHashInput_1(link with tHashOutput_1)---main----tFileOutputMSXML
tHashInput_2(link with tHashOutput_1)---main----
tHashInput_3(link with tHashOutput_1)---main----
Shong

----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] MSXML processing different loops problem

Hi Shong, thanks for your answer. You have a small typo - each tHashInput should be linked with appropriate tHashOutput, not with tHashOutput1.
I've attached screenshot of my job.
I've tried this job with trigger OnSubjobOk and without it, in both cases it works fine. Could you tell me why have I got the same results ?
And one more question - I could connect OnSubjobOk trigger to only one tHashInput component, does it mean that all 3 tHashInput components would be synchronized with this single trigger or there is a way to connect OnSubJobOk trigger to each tHashInput component ?
Community Manager

Re: [resolved] MSXML processing different loops problem

Hi
The three tHashInput components and tFileOutputMSXML constitutes a subjob, you have two subjobs in this job.


Regards

Shong

----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] MSXML processing different loops problem

i am having another concern can you please check this one as well.
<?xml version="1.0" encoding="UTF-8"?>
<Customers xmlns:xsi=""
    xsi:noNamespaceSchemaLocation="customer4.xsd">
    <Customer id="1">    
        <CustomerName>Griffith Paving and Sealcoatin</CustomerName>
        <CustomerAdresses>
            <CustomerAddress>talend apres 91</CustomerAddress>
            <CustomerAddress>511 Maple Ave. Apt. 1B</CustomerAddress>
            <CustomerAddress>1799 Rosemary Way</CustomerAddress>
            <CustomerAddress>1859 Green Bay Rd.1</CustomerAddress>
        </CustomerAdresses>
        <LabelState>Connecticut</LabelState>
        <RegTime>03-11-2006</RegTime>
        <Fresh>67852.0</Fresh>
        <Frozen>61521.4852</Frozen>
    </Customer>
    <Customer id="2">
        <CustomerName>Bill's Dive Shop</CustomerName>
        <CustomerAdresses>
            <CustomerAddress>310 Walker Ave.</CustomerAddress>
            <CustomerAddress>844 Spruce St.</CustomerAddress>
            <CustomerAddress>965 Marion Place Apt. 65C</CustomerAddress>
            <CustomerAddress>511 Hill</CustomerAddress>
        </CustomerAdresses>
        <LabelState>zona</LabelState>
        <RegTime>19-11-2004</RegTime>
        <Fresh>88792.0</Fresh>
        <Frozen>15434.1</Frozen>
    </Customer>

</Customers>
i am having the above xml file and i want the output like 
id  name
1   Griffith Paving and Sealcoatin 
2   Bill's Dive Shop
i am using t fileinputMSXML with the
root Xpath Query : "/Customers"
schema Xpath Loop :"/Customer"
Xpath Queries :"@id","../CustomerName"
but it is giving output as 
1
2
Any help.

Thanks in advance.
One Star

Re: [resolved] MSXML processing different loops problem

Thanks 
It resolved now.