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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

read xml with loops

Bonjour,

 

can you tell me how to manage subloops in xml ?

 

I am playing with tExtractXMLField and tXMLMap for hours but I did not succeed to extract data correctly from XML root :

 

"/GetOccurrencesResponse/GetOccurrencesResult/Occurrence"

 

I have a first part with ; /DataFields/DataField having attributes ; - ControlType -DataType -DisplayLabel -ElementIdentifier -Name -Value

And a second part with attributes - ID - IncidentId - Incident number ...

 

here is my xml :

 

<?xml version="1.0" encoding="ISO-8859-15"?> -<root> -<row> <Header/> <Body><GetOccurrencesResponse xmlns="http://www.abc.com/abcWebServices/v1.2/"><GetOccurrencesResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Occurrence><Attachments /><BrokenRules />

 

<DataFields>

<DataField><ControlType>TextEdit</ControlType><DataType>Numeric</DataType> <DisplayLabel>Flight ID</DisplayLabel><ElementIdentifier>Ffbf9ece5ad0c47c592cf676de2f860e2</ElementIdentifier><Name>IdFlight_ergoss</Name><ReferenceListName /><Value>1</Value></DataField>

<DataField><ControlType>TextEdit</ControlType><DataType>String</DataType> <DisplayLabel>Registration</DisplayLabel><ElementIdentifier>Fa82246081ab74cf48a2a1f0af5aef4ec</ElementIdentifier><Name>Registration_ergoss</Name><ReferenceListName /><Value>test registration</Value></DataField>

</DataFields>

<ID>8641</ID> <IncidentId>-1</IncidentId> <IncidentNumber /> <IncidentStatusName /> <IncidentTitle /> <IsMain>true</IsMain> <LocationName /><Notes /> <Number>FDM-137</Number> <RecordedByPersonName>SARA, ERGOSS</RecordedByPersonName> <RecordedDate>2020-02-05T14:05:56.763</RecordedDate> <ReportTypeName>ERGOSS</ReportTypeName> <ReportedByPersonName>User, API</ReportedByPersonName> <ReportedDate>2020-02-05T13:05:00</ReportedDate> <Title>Title4Test</Title> </Occurrence><Occurrence><Attachments /><BrokenRules />

 

<DataFields>

<DataField><ControlType>TextEdit</ControlType><DataType>Numeric</DataType> <DisplayLabel>Flight ID</DisplayLabel><ElementIdentifier>Ffbf9ece5ad0c47c592cf676de2f860e2</ElementIdentifier><Name>IdFlight_ergoss</Name><ReferenceListName /><Value>1</Value></DataField>

<DataField><ControlType>TextEdit</ControlType><DataType>String</DataType> <DisplayLabel>Registration</DisplayLabel><ElementIdentifier>Fa82246081ab74cf48a2a1f0af5aef4ec</ElementIdentifier><Name>Registration_ergoss</Name><ReferenceListName /><Value>test registration</Value></DataField>

</DataFields>

<ID>8642</ID> <IncidentId>-1</IncidentId> <IncidentNumber /> <IncidentStatusName /> <IncidentTitle /> <IsMain>true</IsMain> <LocationName /> <Notes /> <Number>FDM-138</Number> <RecordedByPersonName>SARA, ERGOSS</RecordedByPersonName> <RecordedDate>2020-02-05T14:12:07.407</RecordedDate> <ReportTypeName>ERGOSS</ReportTypeName> <ReportedByPersonName>User, API</ReportedByPersonName> <ReportedDate>2020-02-05T13:12:00</ReportedDate> <Title>Title4Test</Title> </Occurrence><Occurrence><Attachments /><BrokenRules /> <Fault/> </row> </root>

... 

Labels (3)
8 Replies
Anonymous
Not applicable
Author

I added screen copies ... 


textractXMLfield.JPG
Anonymous
Not applicable
Author

Here is a another full structure of my xml file for 1 occurence in input ... can someone explain how to define my xml extract component and xml metadata to be able to read such file ?

 

Thank's in advance for your help.

 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetOccurrenceResponse xmlns="http://www.fakeabc.com/fakeabcWebServices/v1.2/">
<GetOccurrenceResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Attachments/>
<BrokenRules/>
<DataFields>
<DataField>
<ControlType>CheckEdit</ControlType>
<DataType>Boolean</DataType>
<DisplayLabel>Voluntary Report</DisplayLabel>
<ElementIdentifier>



To see the whole post, download it here
occurencedemo.xml
OriginalPost.pdf
tnewbie
Creator II
Creator II

DamienBlondel,

 

Recently i have worked considerably on xml data sources and was able to loop through the data sources. All you have to ensure here is adding the looping construct at the right place. i can probably help you if i understand your question correctly. Can you please rephrase your question and precisely ask what the problem is.

Anonymous
Not applicable
Author

hello and thank you for your reply.

 

I am not able to read this complex (for me) xml structure ...

 

<GetOccurrencesResponse xmlns="http://www.ffff">

<GetOccurrencesResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

<Occurrence>

<Attachments />

<BrokenRules />

<DataFields>

<DataField>

<ControlType>CheckEdit</ControlType>

<DataType>Boolean</DataType>

<DisplayLabel>Voluntary Report</DisplayLabel>

<ElementIdentifier>F712f969fc0c7438ca4b306894930731e</ElementIdentifier>

<Name>Voluntary Report</Name>

<ReferenceListName />

<Value>false</Value>

</DataField>

<DataField>

                … repeated several times

</DataField>

                                                               …

</DataFields>

 

<ID>8872</ID>                                                                  <=== these is the key of the occurence 

<IncidentId>-1</IncidentId>

<IncidentNumber />

<IncidentStatusName />

<IncidentTitle />

<IsConfidential>true</IsConfidential>

<LocationName>NAP</LocationName>

<Notes />

<Number>ASR-4610</Number>

<RecordedByPersonName>GASINI, Claudio</RecordedByPersonName>

<RecordedDate>2020-02-25T14:56:04.59</RecordedDate>

<ReportTypeName>Air Safety Report</ReportTypeName>

<ReportedByPersonName>DBL LUFO, Stéphane</ReportedByPersonName>

<ReportedDate>2020-02-23T00:00:00</ReportedDate>

<Title />

 

</Occurrence>

 

<Occurrence>

… many other occurences

</Occurrence>

</GetOccurrencesResult>

</GetOccurrencesResponse>

 

I hope it’s clearer … you can see that for each OCCURRENCE, I have 2 blocks

  • DATA FIELDS data contain a list of DATA FIELD (it’s a loop) and these DATA FIELD are all linked with the next block
  • Identification block at the end starting with <ID> … finishing with TITLE …

 

Anonymous
Not applicable
Author

Can upload xml file.

tnewbie
Creator II
Creator II

If i am understanding your problem correctly, you are facing problems in capturing data elements that are repeating with in parent node...if that is what you are looking for then the attached image should give you a fair deal of understanding on how to achieve this. You have to tag a repeating element as a loop element both at the source and target levels with in a tXMLMap component.

 

If my understanding about your problem is not correct, please repeat what the problem is, I can attempt to provide a solution to your problem.


xml_loop.png
tnewbie
Creator II
Creator II

Does this solve your issue..?

Anonymous
Not applicable
Author

Bonjour, 

sorry for late answer. My question is about having a double loop in the same tree.

When I import my file in input, I can see 1 loop only.

Do you know where I can define a double loop ?

regards

Damien

 


DoubleLoop.JPG