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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loading attribute from a specific section in XML file

Hi

I need to load the value of attribute "code" from the first "organizer" according to the attribute "name" as a reference;

For example:   load the value of attribute "code" from the section where attribute name="VC". ( I should get S006).

Here is the XML code:

<entry>

     <organizer classCode="BATTERY" moodCode="EVN">

               <code name="VC" codeSystem="2.16.840"/>

               <component>

                         <observation classCode="OBS" moodCode="EVN">

                              <value code="S006" />

                         </observation>

               </component>

     </organizer>

     <organizer classCode="BATTERY" moodCode="EVN">

               <code name="MB" codeSystem="2.16.840"/>

               <component>

                         <observation classCode="OBS" moodCode="EVN">

                              <value code="S003" />

                         </observation>

               </component>

     </organizer>

</entry>

Please help. Thanks.

20 Replies
rbecher
MVP
MVP

This has to do with the generated synthetic key. Please use this LOAD script and delete all unnecessary fields:

[publicarEspirometries/ClinicalDocument/component/structuredBody/component/section/entry]:

LOAD

[typeCode],

    [observationMedia/ID],

    [observationMedia/classCode],

    [observationMedia/moodCode],

    [observationMedia/value],

    [observationMedia/value/mediaType],

    [observationMedia/value/representation],

    [observationMedia/templateId/extension],

    [observationMedia/templateId/root],

    [organizer/classCode],

    [organizer/moodCode],

    [organizer/statusCode/code],

    [organizer/code/code],

    [organizer/code/codeSystem],

    [organizer/code/displayName],

    [observation/classCode],

    [observation/moodCode],

    [observation/value/unit],

    [observation/value/xsi:type],

    [observation/value/value],

    [observation/value/code],

    [observation/value/codeSystem],

    [observation/value/codeSystemName],

    [observation/value/displayName],

    [observation/statusCode/code],

    [observation/code/code],

    [observation/code/codeSystem],

    [observation/code/displayName],

    [observation/templateId/extension],

    [observation/templateId/root],

    //[%Key_section_8DE2BFA8AE16711D],

    //[%Key_entry_531F1B1B7C50DD70],

    FileBaseName() & '_' & [%Key_entry_531F1B1B7C50DD70] as [%key]

FROM [lib://Daten/Section*.xml]

(XmlSimple, table is [publicarEspirometries/ClinicalDocument/component/structuredBody/component/section/entry])

Where Match([organizer/code/code], 'MMFVC', 'MMFVCMB');

[publicarEspirometries/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component]:

LOAD

[organizer/classCode],

    [organizer/moodCode],

    [organizer/statusCode/code],

    [sequenceNumber/value],

    [observation/classCode],

    [observation/moodCode],

    [observation/value/unit],

    [observation/value/value],

    [observation/value/xsi:type],

    [observation/value/code],

    [observation/value/displayName],

    [observation/value/codeSystem],

    [observation/value/digits],

    [observation/value/scale/unit],

    [observation/value/scale/value],

    [observation/value/origin/unit],

    [observation/value/origin/value],

    [observation/statusCode/code],

    [observation/code/code],

    [observation/code/codeSystem],

    [observation/code/displayName],

    [observation/templateId/extension],

    [observation/templateId/root],

    //[%Key_entry_531F1B1B7C50DD70],

    //[%Key_component_FF3ABE3584473A7D],

    FileBaseName() & '_' & [%Key_entry_531F1B1B7C50DD70] as [%key]

FROM [lib://Daten/Section*.xml]

(XmlSimple, table is [publicarEspirometries/ClinicalDocument/component/structuredBody/component/section/entry/organizer/component])

Where Exists(%key, FileBaseName() & '_' & [%Key_entry_531F1B1B7C50DD70])

AND Match([observation/value/code], 'GQC004', 'GQC006');

Astrato.io Head of R&D