<?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: Applymap variable with a parameter in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127568#M91750</link>
    <description>&lt;P&gt;It's not possible to create a dynamic load-statement in this way because your variable-call returns always a string which won't be interpreted as field-reference. To get it a double dollar-sign expansion would be needed which isn't implemented in the script and also an evaluate() won't help.&lt;/P&gt;
&lt;P&gt;This means you will need to create the dynamic part of the load-statement in before the load. In regard to your probably simplified description you might replace the mapping-approach with a normal table and then using lookup() within the variable-creation, like:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;let vDim2 = '[' &amp;amp; &lt;SPAN class="script_token"&gt;lookup('&lt;/SPAN&gt;&lt;SPAN class="bnf_token"&gt;field_name', 'match_field_name', 1.01, 'table_name'&lt;/SPAN&gt;&lt;SPAN class="script_token"&gt;)&lt;/SPAN&gt; &amp;amp; ']';&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;and then within the load:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;$(vDim2) as Dim2&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this simple way it wouldn't be really dynamic because you would need to specify each relevant parameter. But such logic might be included within a loop-logic and/or all essential information are listed within a table and horizontally + vertically aggregated and assigned to n variables. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Pure technically is everything possible but you should balance the efforts against the targets and if the resulting complexity is really expedient in the long-term.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Oct 2023 14:56:33 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2023-10-11T14:56:33Z</dc:date>
    <item>
      <title>Applymap variable with a parameter</title>
      <link>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127041#M91710</link>
      <description>&lt;P&gt;Hi everyone&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to create a variable which uses applymap with a parameter and then uses this to figure out which field name is used (shown below)&lt;/P&gt;
&lt;P&gt;This variable works without the paramter:&lt;/P&gt;
&lt;P&gt;let vDim2 = '[' &amp;amp; APPLYMAP('MAP_DYN_DIM2',1.01) &amp;amp; ']';&lt;/P&gt;
&lt;P&gt;Variable with parameter:&lt;/P&gt;
&lt;P&gt;let vDim2test = '[' &amp;amp; APPLYMAP('MAP_DYN_DIM2',$1) &amp;amp; ']';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LIVE_DATA:&lt;BR /&gt;LOAD&lt;BR /&gt;1.01 AS REPORT_ID,&lt;BR /&gt;$(vDim2) as DIM2,&lt;BR /&gt;$(vDim3('1.01')) as DIM2test&lt;BR /&gt;FROM [lib://QS_DATA/QVD/xyz.qvd]&lt;BR /&gt;(qvd);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When the above tries to create DIM2Test it does not bring back anything indicating that the parameter is not getting calculated.&amp;nbsp; Has anyone any idea as to why this is incorrect?&lt;/P&gt;
&lt;P&gt;I cannot shre app due to security reasons.&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 12:46:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127041#M91710</guid>
      <dc:creator>bc1</dc:creator>
      <dc:date>2023-10-10T12:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Applymap variable with a parameter</title>
      <link>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127050#M91711</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Not something i have tried before, but my guess would be the syntax and the $ expansion as it is try to do before the variable and the parameter.&lt;/P&gt;
&lt;P&gt;Maybe try&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$($(vDIM2)('1,01'))&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 13:00:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127050#M91711</guid>
      <dc:creator>Mark_Little</dc:creator>
      <dc:date>2023-10-10T13:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Applymap variable with a parameter</title>
      <link>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127058#M91712</link>
      <description>&lt;P&gt;Thanks - but unfortunately I get the same issue.&amp;nbsp; I will continue to have a play around with the syntax.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 13:08:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127058#M91712</guid>
      <dc:creator>bc1</dc:creator>
      <dc:date>2023-10-10T13:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Applymap variable with a parameter</title>
      <link>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127367#M91732</link>
      <description>&lt;P&gt;just bumping this to see if anyone has additional thoughts/ideas on this.&amp;nbsp; thanks everyone&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 08:24:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127367#M91732</guid>
      <dc:creator>bc1</dc:creator>
      <dc:date>2023-10-11T08:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Applymap variable with a parameter</title>
      <link>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127443#M91735</link>
      <description>&lt;P&gt;try this&lt;/P&gt;
&lt;P&gt;Parameters:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Parameter, Value&lt;BR /&gt;Report_ID, 1.01&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;LIVE_DATA:&lt;BR /&gt;LOAD&lt;BR /&gt;Parameter,&lt;BR /&gt;ApplyMap('MAP_DYN_DIM2', Value) as DIM2,&lt;BR /&gt;ApplyMap('MAP_DYN_DIM2', $(=FieldValue('Parameter', 1))) as DIM2test&lt;BR /&gt;RESIDENT Parameters&lt;BR /&gt;WHERE Parameter = 'Report_ID';&lt;/P&gt;
&lt;P&gt;DROP TABLE Parameters;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 10:26:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127443#M91735</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2023-10-11T10:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Applymap variable with a parameter</title>
      <link>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127512#M91744</link>
      <description>&lt;P&gt;that doesn't work either unfortunately.&amp;nbsp; essentially I want to be able to reuse my applymap variable multiple times with different parameters.&lt;BR /&gt;&lt;BR /&gt;so e.g.when $1 = 1.01&lt;BR /&gt;it would load&lt;BR /&gt;REGION as DIM1&lt;BR /&gt;&lt;BR /&gt;if i used 1.02&lt;BR /&gt;it would load&lt;BR /&gt;CONTINENT as DIM1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(this is just an example and it could be many, many dimensions.)&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 12:56:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127512#M91744</guid>
      <dc:creator>bc1</dc:creator>
      <dc:date>2023-10-11T12:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Applymap variable with a parameter</title>
      <link>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127528#M91745</link>
      <description>&lt;P&gt;The syntax isn't quite correct because the applymap() is wrapped with square-brackets, the variable is created per LET and the variable-call queries a string and not a number. Therefore try it with:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SET vDim2test = "APPLYMAP('MAP_DYN_DIM2', $1, 'no Match')";&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;LIVE_DATA:&amp;nbsp;LOAD&lt;BR /&gt;1.01 AS REPORT_ID,&lt;BR /&gt;&lt;STRONG&gt;$(vDim2test(1.01))&lt;/STRONG&gt; as DIM2test&lt;BR /&gt;FROM [lib://QS_DATA/QVD/xyz.qvd]&amp;nbsp;(qvd);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 13:41:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127528#M91745</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-10-11T13:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Applymap variable with a parameter</title>
      <link>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127542#M91747</link>
      <description>&lt;P&gt;Thanks for the help Marcus,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This gets me nearly there and it loads successfully but not quite what is required....&lt;BR /&gt;I want the code to basically say : if 1.01 is mapped to &lt;STRONG&gt;the field&amp;nbsp;&lt;/STRONG&gt;REGION it should say:&lt;BR /&gt;REGION as &lt;SPAN&gt;DIM2test&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;but with the code above it is actually loading it like a string value&lt;BR /&gt;'REGION' as &lt;SPAN&gt;DIM2test&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The reason for the square brackets were in case a field name had a space in the name.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 14:03:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127542#M91747</guid>
      <dc:creator>bc1</dc:creator>
      <dc:date>2023-10-11T14:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Applymap variable with a parameter</title>
      <link>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127568#M91750</link>
      <description>&lt;P&gt;It's not possible to create a dynamic load-statement in this way because your variable-call returns always a string which won't be interpreted as field-reference. To get it a double dollar-sign expansion would be needed which isn't implemented in the script and also an evaluate() won't help.&lt;/P&gt;
&lt;P&gt;This means you will need to create the dynamic part of the load-statement in before the load. In regard to your probably simplified description you might replace the mapping-approach with a normal table and then using lookup() within the variable-creation, like:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;let vDim2 = '[' &amp;amp; &lt;SPAN class="script_token"&gt;lookup('&lt;/SPAN&gt;&lt;SPAN class="bnf_token"&gt;field_name', 'match_field_name', 1.01, 'table_name'&lt;/SPAN&gt;&lt;SPAN class="script_token"&gt;)&lt;/SPAN&gt; &amp;amp; ']';&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;and then within the load:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;$(vDim2) as Dim2&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this simple way it wouldn't be really dynamic because you would need to specify each relevant parameter. But such logic might be included within a loop-logic and/or all essential information are listed within a table and horizontally + vertically aggregated and assigned to n variables. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Pure technically is everything possible but you should balance the efforts against the targets and if the resulting complexity is really expedient in the long-term.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 14:56:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127568#M91750</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-10-11T14:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Applymap variable with a parameter</title>
      <link>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127798#M91769</link>
      <description>&lt;P&gt;understood Marcus, and thanks for taking the time to reply&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 06:10:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Applymap-variable-with-a-parameter/m-p/2127798#M91769</guid>
      <dc:creator>bc1</dc:creator>
      <dc:date>2023-10-12T06:10:23Z</dc:date>
    </item>
  </channel>
</rss>

