<?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: Using peek() function in data load as name of column in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031502#M84960</link>
    <description>&lt;P&gt;You don't need such complicated approach to load your data else you could just load + transform with:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Design/The-Crosstable-Load/ba-p/1468083" target="_blank"&gt;The Crosstable Load - Qlik Community - 1468083&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Jan 2023 11:58:09 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2023-01-30T11:58:09Z</dc:date>
    <item>
      <title>Using peek() function in data load as name of column</title>
      <link>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031433#M84950</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;I have a problem. I am loading a dynamic names of fields. From this script i want to use all names (saved i ntable NameOfFields) to load data from previous table (FinalTable_Temp).&amp;nbsp; But there is the problem, the script returns that, all fields are same as the result of PEEK() function. I want to use PEEK() function to return a NAME of column which returns values from table (FinalTable_Temp) and not use PEEK() function as value. Peek() highlighted below:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for field = 0 to NoOfRows('NamesOfFields') - 1&lt;BR /&gt;&lt;BR /&gt;if IsNum(peek('FieldName',$(field),'NamesOfFields')) then&lt;/P&gt;
&lt;P&gt;vEditedField = '"' &amp;amp; date(peek('FieldName',$(field),'NamesOfFields')) &amp;amp; '"';&lt;/P&gt;
&lt;P&gt;Else&lt;BR /&gt;&lt;BR /&gt;vEditedField = '"' &amp;amp; peek('FieldName',$(field),'NamesOfFields') &amp;amp; '"';&lt;BR /&gt;&lt;BR /&gt;end if&lt;BR /&gt;&lt;BR /&gt;If $(field) = 0 then&lt;BR /&gt;&lt;BR /&gt;FinalTable:&lt;BR /&gt;Load&lt;BR /&gt;SKU as SKUKey,&lt;BR /&gt;&lt;STRONG&gt;peek('FieldName',$(field),'NamesOfFields') as $(vEditedField)&lt;/STRONG&gt;&lt;BR /&gt;Resident FinalTable_Temp;&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;FinalTable:&lt;BR /&gt;Left Join&lt;BR /&gt;Load&lt;BR /&gt;SKU as SKUKey,&lt;BR /&gt;&lt;STRONG&gt;peek('FieldName',$(field),'NamesOfFields') as $(vEditedField)&lt;/STRONG&gt;&lt;BR /&gt;Resident FinalTable_Temp;&lt;/P&gt;
&lt;P&gt;end if&lt;BR /&gt;&lt;BR /&gt;NEXT field&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe is there another solution to solve this problem, but i prefer to use this. Thanks you for the support,&lt;BR /&gt;Ondra Mach&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 10:36:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031433#M84950</guid>
      <dc:creator>Ondrism</dc:creator>
      <dc:date>2023-01-30T10:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using peek() function in data load as name of column</title>
      <link>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031465#M84955</link>
      <description>&lt;P&gt;Hi! I might be misunderstanding something, but if not I believe&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Load&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SKU as SKUKey,&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;$(vEditedField)&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Resident FinalTable_Temp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;should give you the output you want? You don't need the peek()&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 11:13:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031465#M84955</guid>
      <dc:creator>jbhappysocks</dc:creator>
      <dc:date>2023-01-30T11:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using peek() function in data load as name of column</title>
      <link>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031493#M84958</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ondrism_0-1675078924486.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99142i5D84AF1D06836C1A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ondrism_0-1675078924486.png" alt="Ondrism_0-1675078924486.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Problem is, that i need to rename fields name to Date format so firstly use number to load data from previous table a then use the same peek value and trasform it to date and name column after it. Another problem is as you can see in the picture - every value is the same as filed name (result of peek function). Mine script can rename fields to date, but the values are still the number format of that (result of peek function).&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 11:46:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031493#M84958</guid>
      <dc:creator>Ondrism</dc:creator>
      <dc:date>2023-01-30T11:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using peek() function in data load as name of column</title>
      <link>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031499#M84959</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ondrism_0-1675079523120.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99145i075620F64EB70BDB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ondrism_0-1675079523120.png" alt="Ondrism_0-1675079523120.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Main result is this:&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 11:52:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031499#M84959</guid>
      <dc:creator>Ondrism</dc:creator>
      <dc:date>2023-01-30T11:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using peek() function in data load as name of column</title>
      <link>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031502#M84960</link>
      <description>&lt;P&gt;You don't need such complicated approach to load your data else you could just load + transform with:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Design/The-Crosstable-Load/ba-p/1468083" target="_blank"&gt;The Crosstable Load - Qlik Community - 1468083&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 11:58:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031502#M84960</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-01-30T11:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using peek() function in data load as name of column</title>
      <link>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031507#M84961</link>
      <description>&lt;P&gt;i am going to try it, thanks for the tip.&amp;nbsp;&amp;nbsp;I'll let you know if it works.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 12:04:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031507#M84961</guid>
      <dc:creator>Ondrism</dc:creator>
      <dc:date>2023-01-30T12:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using peek() function in data load as name of column</title>
      <link>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031524#M84964</link>
      <description>&lt;P&gt;Crosstable might be very well be what you're after. But to achieve your output table with date in headers you can add/update bold parts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for field = 0 to NoOfRows('NamesOfFields') - 1&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;let vField = peek('FieldName',$(field),'NamesOfFields');&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;if IsNum(peek('FieldName',$(field),'NamesOfFields')) then&lt;/P&gt;
&lt;P&gt;vEditedField = '"' &amp;amp; date(peek('FieldName',$(field),'NamesOfFields')) &amp;amp; '"';&lt;/P&gt;
&lt;P&gt;Else&lt;BR /&gt;&lt;BR /&gt;vEditedField = '"' &amp;amp; peek('FieldName',$(field),'NamesOfFields') &amp;amp; '"';&lt;BR /&gt;&lt;BR /&gt;end if&lt;BR /&gt;&lt;BR /&gt;If $(field) = 0 then&lt;BR /&gt;&lt;BR /&gt;FinalTable:&lt;BR /&gt;Load&lt;BR /&gt;SKU as SKUKey,&lt;BR /&gt;&lt;STRONG&gt;$(vField) as $(vEditedField)&lt;/STRONG&gt;&lt;BR /&gt;Resident FinalTable_Temp;&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;FinalTable:&lt;BR /&gt;Left Join&lt;BR /&gt;Load&lt;BR /&gt;SKU as SKUKey,&lt;BR /&gt;&lt;STRONG&gt;$(vField) as $(vEditedField)&lt;/STRONG&gt;&lt;BR /&gt;Resident FinalTable_Temp;&lt;/P&gt;
&lt;P&gt;end if&lt;BR /&gt;&lt;BR /&gt;NEXT field&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will give you the Date as header and field value as value&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 12:27:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031524#M84964</guid>
      <dc:creator>jbhappysocks</dc:creator>
      <dc:date>2023-01-30T12:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using peek() function in data load as name of column</title>
      <link>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031535#M84966</link>
      <description>&lt;P&gt;Thanks for the tip, I'll try it later when I have time. For now I managed to solve it much easier by using rename filed:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;FOR Column = 1 to NoOfFields('FinalTable_Temp')&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;vEditedField = FieldName($(Column),'FinalTable_Temp');&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;If isnum('$(vEditedField)') then&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;vEditedFieldDate = date(FieldName($(Column),'FinalTable_Temp'));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Rename Field '$(vEditedField)' to '$(vEditedFieldDate)';&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;end if&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NEXT Column&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 12:39:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2031535#M84966</guid>
      <dc:creator>Ondrism</dc:creator>
      <dc:date>2023-01-30T12:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using peek() function in data load as name of column</title>
      <link>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2032069#M85030</link>
      <description>&lt;P&gt;Hi, a reworked the code - now is no need to use peek() function, and it works perfect:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;let j=0;&lt;BR /&gt;FOR Column = 1 to NoOfFields('FinalTable_Temp')&lt;/P&gt;
&lt;P&gt;vEditedField = FieldName($(Column),'FinalTable_Temp');&lt;BR /&gt;&lt;BR /&gt;If isnum('$(vEditedField)') then&lt;BR /&gt;&lt;BR /&gt;vEditedFieldDate = date(FieldName($(Column),'FinalTable_Temp'));&lt;BR /&gt;Rename Field '$(vEditedField)' to '$(vEditedFieldDate)';&lt;BR /&gt;&lt;BR /&gt;j = j + 1;&lt;BR /&gt;let vField$(j) = '[' &amp;amp;FieldName($(Column), 'FinalTable_Temp') &amp;amp; ']';&lt;BR /&gt;&lt;BR /&gt;if j = 1 then&lt;/P&gt;
&lt;P&gt;FinalTable:&lt;BR /&gt;LOAD&lt;BR /&gt;SKU as SKUKey,&lt;BR /&gt;num($(vField$(j))) as $(vField$(j))&lt;BR /&gt;Resident FinalTable_Temp;&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;Left Join(FinalTable)&lt;BR /&gt;Load&lt;BR /&gt;SKU as SKUKey,&lt;BR /&gt;num($(vField$(j))) as $(vField$(j))&lt;BR /&gt;Resident FinalTable_Temp;&lt;BR /&gt;&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;j = j + 1;&lt;BR /&gt;let vField$(j) = '[' &amp;amp;FieldName($(Column), 'FinalTable_Temp') &amp;amp; ']';&lt;BR /&gt;&lt;BR /&gt;if $(Column) = 1 then&lt;BR /&gt;&lt;BR /&gt;FinalTable:&lt;BR /&gt;LOAD&lt;BR /&gt;SKU as SKUKey,&lt;BR /&gt;$(vField$(j)) as $(vField$(j))&lt;BR /&gt;Resident FinalTable_Temp;&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;Left Join(FinalTable)&lt;BR /&gt;Load&lt;BR /&gt;SKU as SKUKey,&lt;BR /&gt;$(vField$(j)) as $(vField$(j))&lt;BR /&gt;Resident FinalTable_Temp;&lt;BR /&gt;&lt;BR /&gt;end if&lt;BR /&gt;&lt;BR /&gt;end if&lt;BR /&gt;&lt;BR /&gt;NEXT Column&lt;/P&gt;
&lt;P&gt;Drop Field SKUKey;&lt;BR /&gt;drop Table FinalTable_Temp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;anyway, thanks you!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 11:05:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-peek-function-in-data-load-as-name-of-column/m-p/2032069#M85030</guid>
      <dc:creator>Ondrism</dc:creator>
      <dc:date>2023-01-31T11:05:06Z</dc:date>
    </item>
  </channel>
</rss>

