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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

extracting data

hi everyone

i create a queue with a data from a table of db and im going to consume the queue and insert the data in another table ..

i use for this textractxml field it just read the rows and icant find any output

first i create a queue on my activemq with data from db table

second i consume it but it failed i cant understand what is the problem with the t extraxtxml fieled

 

0683p000009M1gl.png0683p000009M2AV.png

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

    In your input xml example from source, each client is coming as separate message.

 

<?xml version="1.0" encoding="UTF-8"?>
<root><clients/><client id="0"><cnom>baha</cnom><cprenom>dbeybia</cprenom><cage>22</cage></client></root>

If it has to come as loop with multiple customers, the XML would be as shown below.

 

<?xml version="1.0" encoding="UTF-8"?>
<root><clients>
<client id="0"><cnom>baha</cnom><cprenom>dbeybia</cprenom><cage>22</cage></client>
<client id="1"><cnom>jalel</cnom><cprenom>slimen</cprenom><cage>25</cage></client>
</clients></root>

As per your example, I have taken one client per XML (the first XML) for solution.  Please refer the output below.

0683p000009M2BO.png

 

 

In the example, the first two components is to convert the data to Document data type. Since I am not using queue, I have simulated it by creating a XML string using trowgenerator and converting it into Document type by tConvertType.

 

In your real time scenario, you can directly join tXMLMap to input message in Document format.

 

You will have to map the data in Document data type to target columns as shown below. Please note that id has to be created as an attribute and not as sub element.

 

0683p000009M2BT.png

 

 

Once you complete the mapping as shown above, you will get output as columns which can be transferred to your target DB (instead of tLogrow).

 

Hope, I have answered your query.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

 

 

View solution in original post

7 Replies
Anonymous
Not applicable
Author

Hi,

 

   The first stage in Debugging is to verify whether you are getting the output back from queue in right format. To check that please add a tlogrow and verify the output.

 

  If its working fine, then the next stage is to verify the textractXMLfield. Could you please share a sample XML and the screenshot of your textractXMLfield for reference? I believe the mapping of the fields is not correct. 

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

the output from tlog row when i consume the queue :

[statistics] connecting to socket on port 3391
[statistics] connected
Connecting to URL: tcp://localhost:61616
Consuming queue: ClientData1
We will wait for messages within: 1000 ms, and then we will shutdown
<?xml version="1.0" encoding="UTF-8"?>
<root><clients/><client id="0"><cnom>baha</cnom><cprenom>dbeybia</cprenom><cage>22</cage></client></root>
<?xml version="1.0" encoding="UTF-8"?>
<root><clients/><client id="1"><cnom>jalel</cnom><cprenom>slimen</cprenom><cage>25</cage></client></root>
<?xml version="1.0" encoding="UTF-8"?>
<root><clients/><client id="2"><cnom>wahbi</cnom><cprenom>khazri</cprenom><cage>36</cage></client></root>
<?xml version="1.0" encoding="UTF-8"?>
<root><clients/><client id="3"><cnom>mohamed</cnom><cprenom>ben ali</cprenom><cage>40</cage></client></root>
<?xml version="1.0" encoding="UTF-8"?>
<root><clients/><client id="4"><cnom>said</cnom><cprenom>bjeoui</cprenom><cage>65</cage></client></root>
<?xml version="1.0" encoding="UTF-8"?>
<root><clients/><client id="5"><cnom>hatem</cnom><cprenom>ben arfa</cprenom><cage>20</cage></client></root>
<?xml version="1.0" encoding="UTF-8"?>
<root><clients/><client id="6"><cnom>ali</cnom><cprenom>fff</cprenom><cage>22</cage></client></root>
<?xml version="1.0" encoding="UTF-8"?>
<root><clients/><client id="7"><cnom>mesba7</cnom><cprenom>jarbou3</cprenom><cage>90</cage></client></root>
<?xml version="1.0" encoding="UTF-8"?>
<root><clients/><client id="8"><cnom>chaima</cnom><cprenom>challouf</cprenom><cage>23</cage></client></root>
<?xml version="1.0" encoding="UTF-8"?>

<root><clients/><client id="9"><cnom>jamil</cnom><cprenom>benammar23</cprenom><cage>23</cage></client></root>
[statistics] disconnected

0683p000009M2B9.png

the XML

0683p000009M1uy.png

 

th textractfieled reference

0683p000009M25b.png

 

my database table

0683p000009M2AN.png

 

 


Screenshot from 2018-12-28 06-06-53.png
Anonymous
Not applicable
Author

Hi,

 

    In your input xml example from source, each client is coming as separate message.

 

<?xml version="1.0" encoding="UTF-8"?>
<root><clients/><client id="0"><cnom>baha</cnom><cprenom>dbeybia</cprenom><cage>22</cage></client></root>

If it has to come as loop with multiple customers, the XML would be as shown below.

 

<?xml version="1.0" encoding="UTF-8"?>
<root><clients>
<client id="0"><cnom>baha</cnom><cprenom>dbeybia</cprenom><cage>22</cage></client>
<client id="1"><cnom>jalel</cnom><cprenom>slimen</cprenom><cage>25</cage></client>
</clients></root>

As per your example, I have taken one client per XML (the first XML) for solution.  Please refer the output below.

0683p000009M2BO.png

 

 

In the example, the first two components is to convert the data to Document data type. Since I am not using queue, I have simulated it by creating a XML string using trowgenerator and converting it into Document type by tConvertType.

 

In your real time scenario, you can directly join tXMLMap to input message in Document format.

 

You will have to map the data in Document data type to target columns as shown below. Please note that id has to be created as an attribute and not as sub element.

 

0683p000009M2BT.png

 

 

Once you complete the mapping as shown above, you will get output as columns which can be transferred to your target DB (instead of tLogrow).

 

Hope, I have answered your query.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

 

 

Anonymous
Not applicable
Author

thank you sir i try it look what i get when i debug the job

the first component is  my queue with the document message

0683p000009M21l.png

i map it into txmlmap

0683p000009M2BY.png

and iwant to test it on tlogrow but it shows me  Type mismatch: cannot convert from String to Integer

0683p000009M1oG.png

Anonymous
Not applicable
Author

Hi,

 

    In this case, could you please keep every column in output schema as String and then execute the flow?

 

    If you have to convert the datatype of any specific column to Integer, you can do it by tConverttype later in your job flow.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

 

 

Anonymous
Not applicable
Author

its fine when i test it with tlogrow ( i just change the output to string) :

0683p000009M1sX.png

but if i out mydb table it shows this error :

0683p000009M2Bn.png0683p000009M29s.png

Anonymous
Not applicable
Author

thank you sir i found the problem and i fix it it works thank you for ure time ❤️