Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
qvhjenvo
Contributor
Contributor

Load XML files and create uniq keys in sub tables

Hi,

I have severals xml-files and want to load the files into Qlikview.

I attached an ex. file. Basicly the structure of the xml-files consist two parts 'hode' as main and 'info' as data of 'hode'.

My question is how to make a uniq key for info that belongs to hode


I have tried to make a combination

autonumber(field1 & '-' & field2 & '-' & field3 ..) as %key_xxx

But Qlikview reads just the first record in info table.

Please! somebody help me out of the problems

Thanks in advandce

Loi

3 Replies
el_aprendiz111
Specialist
Specialist

Hi

Directory;

// Start of [test.xml] LOAD statements

info:

LOAD

AutoNumber([%Key_deler_046ECFD0142C0E2C]&"sum"&"feltkode") as MyKey,

feltkode,

    sum,

    [post/posttype] as posttype,

    [post/nr] as nr,

    [post/tall] as tall,

    [post/notehenvisning] as notehenvisning,

    [post/fritekst] as fritekst,

    %Key_deler_046ECFD0142C0E2C    // Key to parent table: deler

FROM [..\..\..\..\..\..\..\..\..\Documents\Downloads\test.xml] (XmlSimple, Table is [deler/del/info]);

hode:

LOAD

  

    orgnr,

    regnskapstype,

    regnaar,

    aarsregnskapstype,

    oppstillingsplan_versjonsnr,

    valutakode,

    regnskap_dokumenttype,

    startdato,

    avslutningsdato,

    mottakstype,

    avviklingsregnskap,

    feilvaloer,

    journalnr,

    orgform,

    mor_i_konsern,

    regler_smaa,

    fravalg_revisjon,

    utarbeidet_regnskapsforer,

    bistand_regnskapsforer,

    fleksible_poster,

    %Key_deler_046ECFD0142C0E2C,    // Key to parent table: deler

    %Key_hode_E7726A61A54DF5A7    // Key for this table: deler/del/hode

   

FROM [..\..\..\..\..\..\..\..\..\Documents\Downloads\test.xml] (XmlSimple, Table is [deler/del/hode]);

deler:

LOAD ant_poster,

    %Key_deler_046ECFD0142C0E2C    // Key for this table: deler

FROM [..\..\..\..\..\..\..\..\..\Documents\Downloads\test.xml] (XmlSimple, Table is [deler]);

// End of [test.xml] LOAD statements

key.png

qvhjenvo
Contributor
Contributor
Author

Hi FF,

Thanks for starting the discussion. The XML-wizard from Qlikview can not help me so much.

What I expect from the test-file is, when I select orgnr and regnskap_dokumenttype, It will show  for ex. data below.

The fields orrgnr and regnkap_dokumenttype are in hode-element.

  

orgnrregnskap_dokumenttypefeltkodesumComment
938389942RES7211723617
938389942RES810
938389942RES821116578
938389942RES1462815233
938389942RES..etc
938389942RES..etc
938389942RES..etc
938389942RES366331913001Last element
938389942BAL4743904872
938389942BAL80845392
938389942BAL854997078
938389942BAL8627730259
938389942BAL..etc
938389942BAL..etc
938389942BAL29042941320Last element

I have made a key like this

AutoNumber('$(vInn_FilNavn)'& "[hode/orgnr]" &"[hode/aarsregnskapstype]" & "[hode/oppstillingsplan_versjonsnr]" & "[hode/regnskap_dokumenttype]" & "[info/feltkode]") as %key_line_start,

But it read just first element. That is problem.

Regards

/Loi

cotiso_hanganu
Partner - Creator III
Partner - Creator III

Hi there,

I have been trying various things in reading XML files over the years....

I assume you have to use the %Key_<XMLtable>_<HEXCODE>  fields,

that Qlik Script Wizard for reading xml is creating (at least in Qlikview).


PS: But I didn't  figure it out how the HEXCODE is actually generated, so I can create it without the wizard.
Anyone knows ?