<?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 Performing LET var = only({Set analysis} Field) in a macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Performing-LET-var-only-Set-analysis-Field-in-a-macro/m-p/320484#M707281</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the user makes a selection in a particular field I would like about 30 variables to be updated with the result of an &lt;SPAN style="font-family: courier new,courier;"&gt;only&lt;/SPAN&gt;-statement including some set analysis. I am aware that this can be done by using the set variable functionality under field actions -&amp;gt; external actions 30 times, but this is a bit messy in my opinion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, can it be achieved using a macro? Abusing notation a bit, I would like to have 30 statements like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;LET var_i = only({$&amp;lt;A={"B_i"}&amp;gt;} Field)&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that macros can set variables, so it is primarily the &lt;SPAN style="font-family: courier new,courier;"&gt;only&lt;/SPAN&gt;-part with the set analysis I am wondering about.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Feb 2012 08:56:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-02-27T08:56:05Z</dc:date>
    <item>
      <title>Performing LET var = only({Set analysis} Field) in a macro</title>
      <link>https://community.qlik.com/t5/QlikView/Performing-LET-var-only-Set-analysis-Field-in-a-macro/m-p/320484#M707281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the user makes a selection in a particular field I would like about 30 variables to be updated with the result of an &lt;SPAN style="font-family: courier new,courier;"&gt;only&lt;/SPAN&gt;-statement including some set analysis. I am aware that this can be done by using the set variable functionality under field actions -&amp;gt; external actions 30 times, but this is a bit messy in my opinion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, can it be achieved using a macro? Abusing notation a bit, I would like to have 30 statements like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;LET var_i = only({$&amp;lt;A={"B_i"}&amp;gt;} Field)&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that macros can set variables, so it is primarily the &lt;SPAN style="font-family: courier new,courier;"&gt;only&lt;/SPAN&gt;-part with the set analysis I am wondering about.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2012 08:56:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Performing-LET-var-only-Set-analysis-Field-in-a-macro/m-p/320484#M707281</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-27T08:56:05Z</dc:date>
    </item>
    <item>
      <title>Performing LET var = only({Set analysis} Field) in a macro</title>
      <link>https://community.qlik.com/t5/QlikView/Performing-LET-var-only-Set-analysis-Field-in-a-macro/m-p/320485#M707282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;This is the macro that you need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub setVariables()&lt;/P&gt;&lt;P&gt; dim i&lt;/P&gt;&lt;P&gt; for i=1 to 30&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ActiveDocument.CreateVariable "var_" &amp;amp; i&lt;/P&gt;&lt;P&gt;'if your variables already exist, you dont need the line above&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; set v = ActiveDocument.GetVariable("var_" &amp;amp; i)&lt;/P&gt;&lt;P&gt; v.SetContent "only({$&amp;lt;A={B_" &amp;amp; i &amp;amp; "}&amp;gt;} Field)",true&lt;/P&gt;&lt;P&gt; next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can call it from Actions -&amp;gt; External -&amp;gt;&amp;nbsp; Run&amp;nbsp; Macro&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 17:21:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Performing-LET-var-only-Set-analysis-Field-in-a-macro/m-p/320485#M707282</guid>
      <dc:creator>erichshiino</dc:creator>
      <dc:date>2012-02-28T17:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Performing LET var = only({Set analysis} Field) in a macro</title>
      <link>https://community.qlik.com/t5/QlikView/Performing-LET-var-only-Set-analysis-Field-in-a-macro/m-p/320486#M707283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey, you're right! Thanks! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Feb 2012 12:29:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Performing-LET-var-only-Set-analysis-Field-in-a-macro/m-p/320486#M707283</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-29T12:29:00Z</dc:date>
    </item>
  </channel>
</rss>

