<?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: Automatically create column(using subfiedl) in load script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765847#M591046</link>
    <description>&lt;P&gt;That was great&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;question though - it didnt behave the way i expected it with the preload:&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;t2:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;load *, rowno() as R;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;load @1, @2, @3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from_field (t1, s) (txt, utf8, no labels, delimiter is '&amp;amp;', msq);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;it created a table, &amp;lt;1&amp;gt; (i guess the table name came from the field @1) then it proceeded to do the preload.&amp;nbsp; can you pls comment on that?&amp;nbsp; that means these two statements created two tables.&amp;nbsp; is there a way to get around that?&lt;/P&gt;</description>
    <pubDate>Wed, 02 Dec 2020 21:21:57 GMT</pubDate>
    <dc:creator>edwin</dc:creator>
    <dc:date>2020-12-02T21:21:57Z</dc:date>
    <item>
      <title>Automatically create column(using subfiedl) in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765467#M591042</link>
      <description>&lt;P&gt;Hi folks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a high level case at least for me,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have&amp;nbsp; a load script a with a big string which i need to divide several times depends on count :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table:
load 
[big string],
subfield([big_string], '&amp;amp;', 1) as field 1,
subfield([big_string], '&amp;amp;', 2) as field 2,
subfield([big_string], '&amp;amp;', 3) as field 3,
subfield([big_string], '&amp;amp;', 4) as field 4,
subfield([big_string], '&amp;amp;', 5) as field 5,
subfield([big_string], '&amp;amp;', 6) as field 6,
..............
resident temp_table;&lt;/LI-CODE&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;So i know have many i have '&amp;amp;' and know how many times i need to to use subfield,&lt;/P&gt;&lt;P&gt;i want to do it fully automatically, so if i have number 10 i know that should be 10 fields with subfield if 2 there will be 2 fields with subfield, one idea that comes to my mind is using loop but how later attached that column to main column i don't know.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can do in a very simple way&amp;nbsp;to create 50 fields with 50 subfield, but i would like to have it more flexible&lt;/P&gt;&lt;P&gt;Thank you in advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 13:47:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765467#M591042</guid>
      <dc:creator>Micki</dc:creator>
      <dc:date>2020-12-01T13:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create column(using subfiedl) in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765483#M591043</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/124906"&gt;@Micki&lt;/a&gt;&amp;nbsp; One automatic solution with loop&lt;BR /&gt;you can remove the last loop but I keep it to combine the tables.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Data:

load *,rowno() as Idtmp, SubStringCount(big_string, '&amp;amp;') as counttmp inline [
big_string,Dimension1,Dimension2
Field1&amp;amp;Field2&amp;amp;Field3&amp;amp;Field4,a,c
Field1&amp;amp;Field2&amp;amp;Field3&amp;amp;Field4&amp;amp;Field5,b,d
];


LET NumRows=NoOfRows('Data');

FOR i=0 to $(NumRows)-1
	 
  LET Vbig_string=Peek('big_string',$(i),'Data');
  LET VIdtmp=Peek('Idtmp',$(i),'Data');
  LET Vcounttmp=Peek('counttmp',$(i),'Data')+1;
 
	FOR j=1 to $(Vcounttmp)

	load big_string,subfield(big_string,'&amp;amp;',$(j)) as Field$(j) resident Data where Idtmp=$(VIdtmp);
		
NEXT;
NEXT;



CombinedGenericTable:

Load distinct big_string,Dimension1,Dimension2 resident Data;

drop table Data;

FOR i = NoOfTables()-1 to 0 STEP -1

  LET vTable=TableName($(i));

  IF WildMatch('$(vTable)', 'Data*') THEN 

  LEFT JOIN ([CombinedGenericTable]) LOAD distinct * RESIDENT [$(vTable)];

  DROP TABLE [$(vTable)];

  ENDIF 

NEXT i&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Taoufiq_Zarra_0-1606833447000.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/45062i4032116DD59B10BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Taoufiq_Zarra_0-1606833447000.png" alt="Taoufiq_Zarra_0-1606833447000.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 721px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/45063iB10E5EFA47EB37F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 14:38:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765483#M591043</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-12-01T14:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create column(using subfiedl) in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765489#M591044</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/124906"&gt;@Micki&lt;/a&gt;&amp;nbsp; Try below. This will create dynamic formula for maximum count of delimiter in your data which is always better than running loop over actual data set which is not good practice&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let vActual_Field_Name = 'big_string'; // specify big string field name
let vDelimiter = '&amp;amp;'; // specify big string delimeter
let vField_Name_After_Split = 'Field'; // specify big string field name

Data:
load *,
    SubStringCount(big_string, '&amp;amp;')+1 as Count_delimiter 
inline [
big_string,Dimension1,Dimension2
Field1&amp;amp;Field2&amp;amp;Field3&amp;amp;Field4,a,c
Field1&amp;amp;Field2&amp;amp;Field3&amp;amp;Field4&amp;amp;Field5,b,d
];

Max_Count:
LOAD max(Count_delimiter) as max_count_delimiter;
LOAD FieldValue('Count_delimiter',RecNo()) as Count_delimiter
AutoGenerate FieldValueCount('Count_delimiter');

let vMax_Count_Delimiter = Peek('max_count_delimiter',0,'Max_Count');

// create dynamic subfield formula

for i=1 to $(vMax_Count_Delimiter)

Formula:
LOAD 'subfield('&amp;amp; '$(vActual_Field_Name)'&amp;amp; ','&amp;amp; chr(39)&amp;amp; '$(vDelimiter)'&amp;amp; chr(39)&amp;amp; ',' &amp;amp; $(i) &amp;amp; ')' &amp;amp; ' as ' &amp;amp; '[' &amp;amp; '$(vField_Name_After_Split)' &amp;amp; ' ' &amp;amp; $(i) &amp;amp; ']' as Formula
AutoGenerate 1;

NEXT

Formula_Final:
NoConcatenate
LOAD Concat(Formula,','&amp;amp;chr(10)) as Formula
Resident Formula;

DROP Table Formula;

let vFormula = Peek('Formula',0,'Formula_Final');

DROP Table Formula_Final;

Final_table:
LOAD *,
     $(vFormula)
Resident Data;

DROP Table Data;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 01 Dec 2020 15:14:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765489#M591044</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-12-01T15:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create column(using subfiedl) in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765802#M591045</link>
      <description>&lt;P&gt;An alternative to the already mentioned loop-approaches might be to load these big-string with a from_field approach (alternatively you may store this field within a txt and load then from there) like the following:&lt;/P&gt;&lt;P&gt;t1: load *, rowno() as R inline [&lt;BR /&gt;s&lt;BR /&gt;a&amp;amp;b&amp;amp;c&lt;BR /&gt;1&amp;amp;2&amp;amp;3&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;t2:&lt;BR /&gt;load *, rowno() as R;&lt;BR /&gt;load @1, @2, @3&lt;BR /&gt;from_field (t1, s) (txt, utf8, no labels, delimiter is '&amp;amp;', msq);&lt;/P&gt;&lt;P&gt;join(t1) load * resident t2;&lt;/P&gt;&lt;P&gt;drop tables t2;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marcus_sommer_0-1606930337538.png"&gt;&lt;img src="https://community.qlik.com/skins/images/D90D0B5C99B9DA55E792680D7DABD737/responsive_peak/images/image_not_found.png" alt="marcus_sommer_0-1606930337538.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;- Marcus&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 17:34:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765802#M591045</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-12-02T17:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create column(using subfiedl) in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765847#M591046</link>
      <description>&lt;P&gt;That was great&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;question though - it didnt behave the way i expected it with the preload:&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;t2:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;load *, rowno() as R;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;load @1, @2, @3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from_field (t1, s) (txt, utf8, no labels, delimiter is '&amp;amp;', msq);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;it created a table, &amp;lt;1&amp;gt; (i guess the table name came from the field @1) then it proceeded to do the preload.&amp;nbsp; can you pls comment on that?&amp;nbsp; that means these two statements created two tables.&amp;nbsp; is there a way to get around that?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 21:21:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765847#M591046</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2020-12-02T21:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create column(using subfiedl) in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765922#M591047</link>
      <description>&lt;P&gt;It's not quite clear for me what you mean with creating two tables. The first table t1 is just to get data - within a real scenario there will be probably already a resident-table for it - and the second table is loading from this field quite similar as if it would be an external txt-file.&lt;/P&gt;&lt;P&gt;Nevertheless the feature of from_field is a bit tricky (at least I don't use it often and therefore I struggle sometimes with it and therefore I keep it usually as simple as possible) - therefore I didn't try to add [s] as a join-key else used the rowno() as key created in the preceeding-part (by larger datasets the join with a number would be certainly faster as with the big-string ).&lt;/P&gt;&lt;P&gt;Please elaborate your issue more detailed if this didn't helped enough.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 09:16:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1765922#M591047</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-12-03T09:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create column(using subfiedl) in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1766386#M591048</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/56648"&gt;@Taoufiq_Zarra&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;for me the best solutions the one provided by&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp;, faster and safer.&lt;/P&gt;&lt;P&gt;thank you again so much ALL of you,&amp;nbsp; for your time and help, it's really helps me a lot and i able to improve my scripting skills.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 17:29:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1766386#M591048</guid>
      <dc:creator>Micki</dc:creator>
      <dc:date>2020-12-04T17:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create column(using subfiedl) in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1766460#M591049</link>
      <description>&lt;P&gt;subfield without third parameter&lt;/P&gt;</description>
      <pubDate>Sat, 05 Dec 2020 11:19:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automatically-create-column-using-subfiedl-in-load-script/m-p/1766460#M591049</guid>
      <dc:creator>mikaelsc</dc:creator>
      <dc:date>2020-12-05T11:19:58Z</dc:date>
    </item>
  </channel>
</rss>

