You are not logged in.
Announcement
Unanswered posts
|
sorry . typo..in the above xml
Provider id is "11" for the Secondary provider
<provider id="11">
<providername>Secondary</providername>
</provider>
Thanks Shong. Im able to get the value. Im not able to do all the steps put together.
Input xml:
------------
<ROOT>
<Products>
<Product id ="A12G17">
<name>XBOX</name>
<description>This is xbox P1</description>
<provider id="10">P1</provider>
</Product>
<Product id ="A12G18">
<name>XBOX</name>
<description>This is xbox P2</description>
<provider id ="11">P2</provider>
</Product>
</Products>
<Providers>
<provider id="10">
<providername>Primary</providername>
</provider>
<provider id="10">
<providername>Secondary</providername>
</provider>
</Providers>
</ROOT>
Tables are: allproduct ,product
I like to do the following:
1.Input is xml.
2. Parse the xml
if(${name} is new){
1. create a row with name ,create id for it in "product" table
2. return that id
3. store that id in allproducts table in product_id column
}else{
1. return the id where product.name=${name} from xml
2. store that id in allproducts table in product_id column
}
3.store each product in xml in to "allproduct" table as such.
Final Table output should be:
-------------------------------------
product table
---------------
id name
1000 XBOX
Here id is auto increment starts with 1000
allproduct Table
--------------------
id name product_id provider_id provider_name description
A12G17 XBOX 1000 10 Primary This is xbox P1
A12G18 XBOX 1000 11 Secondary This is xbox P2
Thanks in advance.
Hello
But i have to do both 2 and 3 while i parse the xml.
I tried in Talend using tFileInputXml and tMysqlInput connected using row->iterate but i cant pass the value of <name> from xml to where clause in tMysqlInput query .
Using the iterate link to pass the value to tMysqlInput(see the screenshot)
Best regards
shong
Here is the problem statement,
<ROOT>
<Products>
<Product id ="A12G17">
<name>XBOX</name>
<description>2009-03-31</description>
<provider>P1</provider>
</Product>
<Product id ="A12G18">
<name>XBOX</name>
<description>2009-03-31</description>
<provider>P2</provider>
</Product>
</Products>
</ROOT>
Tables are: allproduct ,product
I like to do the following:
1.Input is xml.
2. Parse the xml
if(${name} is new){
1. create a row with name ,create id for it in "product" table
2. return that id
}else{
1. return the id where product.name=${name} from xml
}
3.store each product in xml in to "allproduct" table as such.
I achieved 3rd step using tFileInputXml and tMysqlInput connected using row->main
But i have to do both 2 and 3 while i parse the xml.
I tried in Talend using tFileInputXml and tMysqlInput connected using row->iterate but i cant pass the value of <name> from xml to where clause in tMysqlInput query . then i have to get tMysqlInput.NB_LINE ,if NB_LINE returns is zero ,i create a row or i have to return the id from "product" table or it could be done using tMap.
Im a bit new to talend. Please guide me what are all components can be used to achieve the same
Thanks in advance