<?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: Dynamic Format and Tag loader (let only set analysis problem) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Dynamic-Format-and-Tag-loader-let-only-set-analysis-problem/m-p/510382#M190705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, so I finally figured out the small tweaks i needed to do, also, needed to use Peek, instead of FieldValue.&amp;nbsp; Any suggestions on a better way to write this would be appreciated as it has to run through the loop for every field i have, it would be nice to run all of it at once, not sure if I can create an array or something within QV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR i=1 to $(RCount)&lt;/P&gt;&lt;P&gt;LET vField_Name = Peek('FieldNames',i-1,'fieldList');&lt;/P&gt;&lt;P&gt;Let vField_Format = Peek('FormatScripts',i-1,'fieldList');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vField_Load = vField_Format &amp;amp; ' as ' &amp;amp; vField_Name;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Dec 2013 22:01:58 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-12-19T22:01:58Z</dc:date>
    <item>
      <title>Dynamic Format and Tag loader (let only set analysis problem)</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-Format-and-Tag-loader-let-only-set-analysis-problem/m-p/510380#M190703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to dynamically generate a load statement at runtime given the values in an excel file.&amp;nbsp; Essentially, the values in the excel file are all of the fields in the application with some 'Metadata' esque values like preferred formatting and additional tags, that get loaded.&amp;nbsp; The problem I have run into, is that I am trying to load all of the fields and the format codes (which translate into variables).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the basic, non-dynamic result is something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Formats:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;//Port_Perf_BMPerf (all 3)&lt;/P&gt;&lt;P&gt;$(fdate) as %BUSINESS_DATE_PERF,&lt;/P&gt;&lt;P&gt;$(fdate) as INCEPTION_DATE,&lt;/P&gt;&lt;P&gt;$(fdate) as ORG_INCEPTION_DATE,&lt;/P&gt;&lt;P&gt;$(fdate) as ORG_PERF_INCP_DATE,&lt;/P&gt;&lt;P&gt;$(fdate) as PERF_TERMIN_DATE,&lt;/P&gt;&lt;P&gt;$(fdate) as %BUSINESS_DATE_BMPERF,&lt;/P&gt;&lt;P&gt;$(fdate) as ACCOUNT_INCP_DATE&lt;/P&gt;&lt;P&gt;AutoGenerate(1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where the variables are:&lt;/P&gt;&lt;P&gt;set f3_dec = Num(1,'#,##0.000;(#,##0.000)');&lt;/P&gt;&lt;P&gt;set f2_dec = Num(1,'#,##0.00;(#,##0.00)');&lt;/P&gt;&lt;P&gt;set fdate = Date(Today(),'MM/DD/YYYY');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently, I created this in an include txt file; however, I want to be able to make changes easily, thus store in an Excel file.&amp;nbsp; I am then creating each of these load statements dynamically with code like the below.&amp;nbsp; My problem is the red line where I am trying to grab the value in FormatScripts, for each name (there are only 4 distinct values in FormatScripts, while there are 200 fields).&amp;nbsp; The red line refuses to return a value.&amp;nbsp; the '%BUSINESS_DATE_PERF' is a hardcoded version of the value that would be returned in vField_Name for testing.&amp;nbsp; Any suggestions on how best to design this would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fieldList:&lt;/P&gt;&lt;P&gt;LOAD FormatScripts, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FieldNames&lt;/P&gt;&lt;P&gt;FROM Include\Metadata.xlsx&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Format:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;1 as dummy&lt;/P&gt;&lt;P&gt;AutoGenerate(1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET RCount = FieldValueCount('FieldNames');&lt;/P&gt;&lt;P&gt;FOR i=1 to $(RCount)&lt;/P&gt;&lt;P&gt;LET vField_Name = FieldValue('FieldNames',$(i));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff6600;"&gt;let vfield_val = only({&amp;lt;FieldNames={'%BUSINESS_DATE_PERF'}&amp;gt;}FormatScripts);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;//Lookup('FormatScripts','FieldNames',$(vField_Name));&lt;/P&gt;&lt;P&gt;//Only({&amp;lt;FieldNames={='$(vField_Name)'}&amp;gt;} FormatScripts);&lt;/P&gt;&lt;P&gt;LET vField_Load = FieldValue('FormatScripts',$(i)) &amp;amp; ' as ' &amp;amp; FieldValue('FieldNames',$(i));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;temp_formats:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;$(vField_Load)&lt;/P&gt;&lt;P&gt;//FieldValue('FormatScripts',$(i)) &amp;amp; ' as ' &amp;amp; FieldValue('FieldNames',$(i))&lt;/P&gt;&lt;P&gt;AutoGenerate(1)&lt;/P&gt;&lt;P&gt;//Resident fieldList&lt;/P&gt;&lt;P&gt;//Where FieldNames = [$(vField_Name)]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outer Join (temp_formats)&lt;/P&gt;&lt;P&gt;LOAD Distinct * Resident Format;&lt;/P&gt;&lt;P&gt;DROP Table temp_formats;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEXT i;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 21:19:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-Format-and-Tag-loader-let-only-set-analysis-problem/m-p/510380#M190703</guid>
      <dc:creator />
      <dc:date>2013-12-19T21:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Format and Tag loader (let only set analysis problem)</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-Format-and-Tag-loader-let-only-set-analysis-problem/m-p/510381#M190704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set analysis cannot be used in the script. You need to do this differently, e.g. by using an If()-function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 22:01:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-Format-and-Tag-loader-let-only-set-analysis-problem/m-p/510381#M190704</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2013-12-19T22:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Format and Tag loader (let only set analysis problem)</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-Format-and-Tag-loader-let-only-set-analysis-problem/m-p/510382#M190705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, so I finally figured out the small tweaks i needed to do, also, needed to use Peek, instead of FieldValue.&amp;nbsp; Any suggestions on a better way to write this would be appreciated as it has to run through the loop for every field i have, it would be nice to run all of it at once, not sure if I can create an array or something within QV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR i=1 to $(RCount)&lt;/P&gt;&lt;P&gt;LET vField_Name = Peek('FieldNames',i-1,'fieldList');&lt;/P&gt;&lt;P&gt;Let vField_Format = Peek('FormatScripts',i-1,'fieldList');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vField_Load = vField_Format &amp;amp; ' as ' &amp;amp; vField_Name;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 22:01:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-Format-and-Tag-loader-let-only-set-analysis-problem/m-p/510382#M190705</guid>
      <dc:creator />
      <dc:date>2013-12-19T22:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Format and Tag loader (let only set analysis problem)</title>
      <link>https://community.qlik.com/t5/QlikView/Dynamic-Format-and-Tag-loader-let-only-set-analysis-problem/m-p/510383#M190706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a variable that held the entire load statement, then after the loop, loaded the table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 22:19:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dynamic-Format-and-Tag-loader-let-only-set-analysis-problem/m-p/510383#M190706</guid>
      <dc:creator />
      <dc:date>2013-12-19T22:19:55Z</dc:date>
    </item>
  </channel>
</rss>

