Seven Stars

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

 

 

Thanks,
Sid
Mark as solution if this resolved your issue
3 REPLIES
Twelve Stars

Re: Extract XML field data on a condition

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)

Rilhia Solutions
Seven Stars

Re: Extract XML field data on a condition

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
Thanks,
Sid
Mark as solution if this resolved your issue
Twelve Stars

Re: Extract XML field data on a condition

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

Rilhia Solutions