<?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: Create script expression from variable no of fields in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223484#M623644</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michiel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at the script in the attached file.&lt;/P&gt;&lt;P&gt;I hope it will suit to your data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jan 2017 15:55:01 GMT</pubDate>
    <dc:creator>daveamz</dc:creator>
    <dc:date>2017-01-10T15:55:01Z</dc:date>
    <item>
      <title>Create script expression from variable no of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223479#M623639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to create this:&lt;/P&gt;&lt;P&gt;rangesum(Field1, Field2, Field3)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; as&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My challenge is this:&lt;/P&gt;&lt;P&gt;I have to loop over multiple qvd's. Each qvd is processed one by one Each qvd has a different number of columns. The rangesum must be performed over a variety of 43 to 48 columns.&lt;/P&gt;&lt;P&gt;I was trying to generate a new empty table with only the headers to concatenate the data into that table.&lt;/P&gt;&lt;P&gt;The result of the empty table would be 7 fixed ID fields + the rangesum expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like this:&lt;/P&gt;&lt;P&gt;Fact:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt;"&gt;''&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; ID1,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; as&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; as&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID3,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; etc.,,&lt;/P&gt;&lt;P&gt;Rangesum&lt;SPAN style="font-size: 13.3333px;"&gt;(Field1, Field2, Field3)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; as&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;autogenerate(0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Concatanate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Fact_data:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Load * from ..... .qvd (qvd);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;I have tried to use iterno() in the script in variables to generate the fieldnames. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;And I tried to concat multiple variables to 1 new variable with the rangesum added (with the purpose to add that to my Fact table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;However, this didn't give me the results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Please advise.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Thanks&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2017 14:50:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223479#M623639</guid>
      <dc:creator>Michiel_QV_Fan</dc:creator>
      <dc:date>2017-01-10T14:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create script expression from variable no of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223480#M623640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michiel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can loop through your fields before loading them with &lt;SPAN style="font-size: 13.3333px;"&gt;QvdNoOfFields&lt;/SPAN&gt;(). You'll get the fieldnames with the function QvdFieldName (). Create a variable before you load each QVD and use this variable within your Rangesum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will this works?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2017 15:01:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223480#M623640</guid>
      <dc:creator>gardenierbi</dc:creator>
      <dc:date>2017-01-10T15:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create script expression from variable no of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223481#M623641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could it be that you have stored crosstables within your qvd's? If yes it might be appropriate to change this into "normal" data-structures. How, see here: &lt;A href="https://community.qlik.com/qlik-blogpost/3628"&gt;The Crosstable Load&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2017 15:14:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223481#M623641</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2017-01-10T15:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create script expression from variable no of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223482#M623642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sander, yes that is the basic idea.&lt;/P&gt;&lt;P&gt;However, I have not succeeded yet to create this:&lt;/P&gt;&lt;P&gt;Rangesum(Field1. Field2, ..) as ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hoped I could do this with concat, a variable and a loop but that generates only 1 field inside the concat, not 43 to 48 fields.&lt;/P&gt;&lt;P&gt;for a = 7 to $(number of fields in qvd)&lt;/P&gt;&lt;P&gt;let variable_name = concat($(qvd_fieldname)_$a), ',');&lt;/P&gt;&lt;P&gt;next a&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm stuck in generating a comma separated list.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2017 15:16:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223482#M623642</guid>
      <dc:creator>Michiel_QV_Fan</dc:creator>
      <dc:date>2017-01-10T15:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create script expression from variable no of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223483#M623643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Something like this :&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;let variable_name = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;for a = 7 to $(number of fields in qvd)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; let vFieldName = &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;QvdFieldName ([your qvd], a).&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; let variable_name = '$(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;variable_name)&lt;/SPAN&gt;, $(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;vFieldName&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;next a&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2017 15:34:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223483#M623643</guid>
      <dc:creator>gardenierbi</dc:creator>
      <dc:date>2017-01-10T15:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: Create script expression from variable no of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223484#M623644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michiel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at the script in the attached file.&lt;/P&gt;&lt;P&gt;I hope it will suit to your data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2017 15:55:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-script-expression-from-variable-no-of-fields/m-p/1223484#M623644</guid>
      <dc:creator>daveamz</dc:creator>
      <dc:date>2017-01-10T15:55:01Z</dc:date>
    </item>
  </channel>
</rss>

