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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tExtractXMLField only gets the first element

I have XML coming into the tExtractXMLField that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<search_results product_limit="25" product_offset="0" brand_id="3595">
<products total_count="24">
<product retail_price="239.99" merchant_id="2826" id="286777730"/>
<product retail_price="239.99" merchant_id="2431" id="297971660"/>
<product retail_price="219.99" merchant_id="2431" id="397971661"/>
<product retail_price="239.99" merchant_id="2823" id="354015223"/>
</products>
<merchants>
<merchant product_count="8" network_id="5" merchant_type_id="9" id="2826"/>
<merchant product_count="7" network_id="2" merchant_type_id="9" id="2431"/>
<merchant product_count="3" network_id="2" merchant_type_id="9" id="2823"/>
</merchants>
</search_results>
In the tExtractXMLField, the Loop XPath query is set to: "/search_results"
And the Mapping to get the "id" field from the "product" elements is set to "./products/product/@id"
But I only get 1 row of output, and it's always the first product in the set (id="286777730" in example above)
I've tried setting the "Get Nodes" checkbox for that column (the doc says that setting this will "recuperate" the contents of the select node - not sure what this means)
I've also tried setting the Loop Xpath query to "/search_results/products" and the mapping for "id" to "./product/@id" ... no luck.
It must be something wrong with either my Loop Xpath query or my mapping Xpath ...
Anyone have any idea why I'm not seeing 4 rows of output?
Edit: The <products> section of the example XML was shortened for use in this example, but does actually have 24 <product> elements. And I only get #1 😞
Labels (3)
11 Replies
Anonymous
Not applicable
Author

Hi Shong,
I have set the xpath loop to "record/NumberOnly" as you suggested, but now I'm having trouble setting the xPathQuery to extract the field. I have tried "NumberOnly" but that gave blank since there is no NumberOnly element inside itself. What should the xPathQuery be set to?
Thanks
Anonymous
Not applicable
Author

Hi
I suggest you to create a XML metadata with wizards, you are able to set the xpath loop element and the xpathQuery by drag&drop columns.
Best regards
Shong