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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Sid3
Contributor III
Contributor III

Extract XML field data on a condition

 

Hi,

 

I have source data like below in xml file.

 

 <OrganizationHierarchy Level="OperatingCompany">NMBR</OrganizationHierarchy>
<OrganizationHierarchy Level="Division">TBC</OrganizationHierarchy>
<OrganizationHierarchy Level="Concept">TBC</OrganizationHierarchy>

 

I am pulling data using tXMLMap. PFB screenshots.

 

Output Field1 - i have to pull "organization hierarchy" field based on Level=Division 

Output Field2 - i have to pull "organization hierarchy" field based on Level =OperatingCompany 

Output Field3 - i have to pull "organization hierarchy" field based on Level =Concept

 

how to achieve this in tXMLMap component.

 

For output field1 i have created like this. is it correct. Hope something wrong. Please assist me.

 

[row2.Filename:/POSLog/Transaction/OrganizationHierarchy/@Level].equals("Division") ?
[row2.Filename:/POSLog/Transaction/OrganizationHierarchy] : null

 

 

Labels (3)
3 Replies
Anonymous
Not applicable

It looks like you are going in the right direction. But you might want to look at tMap/tXMLMap variables. This tutorial isn't using xml, but demonstrates a way of handling your issue (https://www.rilhia.com/tutorials/dynamic-column-order)

Sid3
Contributor III
Contributor III
Author

I didn't understand completely. in the blog you are using tmap instaed of txmlMap.

so solution will become little differnt. What i am looking here is sysntax for pulling data withrespect to different conditions in tXMLmap.

Output Field1 - i have to pull "organization hierarchy" field based on Level=Division
Output Field2 - i have to pull "organization hierarchy" field based on Level =OperatingCompany
Output Field3 - i have to pull "organization hierarchy" field based on Level =Concept

something like below :

[row2.Filename:/POSLog/Transaction/OrganizationHierarchy/@Level].equals("Division") ?
[row2.Filename:/POSLog/Transaction/OrganizationHierarchy] : null
Anonymous
Not applicable

Yes, the solution will be a little different. The tutorial was given to give an idea of what may be required.

 

Your example code should just about solve your issue I believe....

 

[row2.Filename:/POSLog/Transaction/OrganizationHierarchy/@Level].equals("Division") ?
[row2.Filename:/POSLog/Transaction/OrganizationHierarchy] : null