<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Load table with same content but different column names in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Load-table-with-same-content-but-different-column-names/m-p/1923748#M76033</link>
    <description>&lt;P&gt;I cannot think of a simple&amp;nbsp;automatic way to do this, but one solution could be to have an "Alias" statement in the beginning of the script:&lt;/P&gt;&lt;P&gt;Alias&lt;BR /&gt;%Key_GenericData_FDE8B6A546EBA8C1 as %Key,&lt;BR /&gt;%Key_GenericData_FDE8B63786EBA844 as %Key,&lt;BR /&gt;%Key_GenericData_FDE8B6A546E235KJ as %Key,&lt;BR /&gt;%Key_GenericData_FDE8B6A54634DE12 as %Key;&lt;/P&gt;&lt;P&gt;The advantage would be that you then don't need to change the individual Load statements. The disadvantage would be that you need to manage the Alias statement manually.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Apr 2022 07:20:33 GMT</pubDate>
    <dc:creator>hic</dc:creator>
    <dc:date>2022-04-28T07:20:33Z</dc:date>
    <item>
      <title>Load table with same content but different column names</title>
      <link>https://community.qlik.com/t5/App-Development/Load-table-with-same-content-but-different-column-names/m-p/1923722#M76032</link>
      <description>&lt;P&gt;Hello, Community,&lt;/P&gt;
&lt;P&gt;I am facing an issue with the column names.&lt;/P&gt;
&lt;P&gt;I have tens of XML files with 3 fields:&lt;/P&gt;
&lt;P&gt;- 2 of the fields are named the same&lt;/P&gt;
&lt;P&gt;-the third always differs but have the same start&amp;nbsp;%Key_GenericData_&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;tmp:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;LOAD id,&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;value,&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;%Key_GenericData_FDE8B6A546EBA8C1 // Key to parent table: GenericData&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;FROM [...\Eksportas\*xml] (XmlSimple, Table is [GenericData/DataSet/Obs/ObsKey/Value]);&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How could I concatenate all XML files into one table with 3 same column names?&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 06:25:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-table-with-same-content-but-different-column-names/m-p/1923722#M76032</guid>
      <dc:creator>MindaugasBacius</dc:creator>
      <dc:date>2022-04-28T06:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Load table with same content but different column names</title>
      <link>https://community.qlik.com/t5/App-Development/Load-table-with-same-content-but-different-column-names/m-p/1923748#M76033</link>
      <description>&lt;P&gt;I cannot think of a simple&amp;nbsp;automatic way to do this, but one solution could be to have an "Alias" statement in the beginning of the script:&lt;/P&gt;&lt;P&gt;Alias&lt;BR /&gt;%Key_GenericData_FDE8B6A546EBA8C1 as %Key,&lt;BR /&gt;%Key_GenericData_FDE8B63786EBA844 as %Key,&lt;BR /&gt;%Key_GenericData_FDE8B6A546E235KJ as %Key,&lt;BR /&gt;%Key_GenericData_FDE8B6A54634DE12 as %Key;&lt;/P&gt;&lt;P&gt;The advantage would be that you then don't need to change the individual Load statements. The disadvantage would be that you need to manage the Alias statement manually.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 07:20:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-table-with-same-content-but-different-column-names/m-p/1923748#M76033</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2022-04-28T07:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Load table with same content but different column names</title>
      <link>https://community.qlik.com/t5/App-Development/Load-table-with-same-content-but-different-column-names/m-p/1923766#M76036</link>
      <description>&lt;P&gt;&lt;A id="link_13" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6622" target="_self" aria-label="View Profile of Henric_Cronström" aria-describedby="userProfileCard-6622"&gt;&lt;SPAN class="login-bold"&gt;Henric_Cronström&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;, the other challenge is that the files are added every single month. The number of unique key columns is growing constantly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Not so sure how to grab those not manually at the moment. Any thoughts on that?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 08:09:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-table-with-same-content-but-different-column-names/m-p/1923766#M76036</guid>
      <dc:creator>MindaugasBacius</dc:creator>
      <dc:date>2022-04-28T08:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Load table with same content but different column names</title>
      <link>https://community.qlik.com/t5/App-Development/Load-table-with-same-content-but-different-column-names/m-p/1924134#M76062</link>
      <description>&lt;P&gt;Here's an Idea, Loop thru All the files&lt;/P&gt;
&lt;P&gt;1) load some data&lt;/P&gt;
&lt;P&gt;2) loop thru available field names to create a string variable which will be a replacement for the Load statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2.1) if the fieldname is not in the list of the two expected fieldname then add and alias&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2.1.1 goal is to create a string to be used in load statement&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;finalstring&amp;nbsp; =&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ID,Value,&lt;STRONG&gt;Otherfield as Key&amp;nbsp; &amp;nbsp;&amp;lt;&amp;lt;--using if(wildmatch()) below&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Load Data using the variable created in step 2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set vRoot = 'lib:/somedirectory/somesubdirectory/finalXmldirectory/';&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FOR Each FileName in FileList('$(vRoot)'&amp;amp;'*.qvd')&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;&amp;lt;-------i'e tested this with QVd files you can change it to xml&lt;BR /&gt;&lt;BR /&gt;TRACE $(FileName);&lt;BR /&gt;let vcount = Index('$(FileName)','/',SubStringCount('$(FileName)','/'));&lt;BR /&gt;trace $(vcount);&lt;BR /&gt;LET vTableName = Mid('$(FileName)',Index('$(FileName)','/',SubStringCount('$(FileName)','/'))+1);&lt;BR /&gt;TRACE $(vTableName);&lt;BR /&gt;&lt;BR /&gt;Tmp:&lt;BR /&gt;First 10 Load *&lt;BR /&gt;FROM $(FileName)(qvd)&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;//Create string for load statement with alias for the non standard field&lt;/STRONG&gt;&lt;BR /&gt;for i = 1 to NoOfFields('Tmp')&lt;BR /&gt;if i = 1 Then&lt;BR /&gt;vfieldList = if(WildMatch(FieldName(i,'Tmp'),'ID','VALUE')=0,FieldName(i,'Tmp')&amp;amp;' as Key',FieldName(i,'Tmp') );&lt;BR /&gt;Else&lt;BR /&gt;vfieldList = vfieldList &amp;amp;','&amp;amp;if(WildMatch(FieldName(i,'Tmp'),'ID','VALUE')=0,FieldName(i,'Tmp')&amp;amp;' as Key',FieldName(i,'Tmp') ); &lt;BR /&gt;End If&lt;BR /&gt;next i&lt;BR /&gt;&lt;BR /&gt;Drop table Tmp;&lt;BR /&gt;&lt;BR /&gt;Main:&lt;BR /&gt;Load $(vfieldList) From $(FileName)(qvd);&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;//You xml files will continue to auto-concatenate&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;NEXT FileName;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;V&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 16:07:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-table-with-same-content-but-different-column-names/m-p/1924134#M76062</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2022-04-28T16:07:19Z</dc:date>
    </item>
  </channel>
</rss>

