<?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: Variables and Macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variables-and-Macro/m-p/463311#M699661</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Hi Manish,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Gysbert is right... there is no inherit property to distinguish whether it's User or Sytem variables. However, if you can follow a standard naming convention while creating the variables then you can use string/ pattern search to identify whether its User or System variable. And this is good practice when you have more than handful of variables. I always follow a standard naming convention, something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;STRONG style="font-family: calibri,verdana,arial,sans-serif;"&gt;Generic Variables:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_HideShow&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_MyString&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_ConcatFieldValue&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;STRONG style="font-family: calibri,verdana,arial,sans-serif;"&gt;Expression Variables:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_Exp_TotalSales&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_Exp_AvgSales&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_Exp_MonthlySales&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;STRONG style="font-family: calibri,verdana,arial,sans-serif;"&gt;Colour Variables:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_Colour_Primary_01&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_Colour_Primary_02&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Once you follow the standard naming convention then you easily call your variables by using below script.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;Sub VariableNames&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;Set Vars = ActiveDocument.GetVariableDescriptions&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;For k = 0 to vars.Count - 1&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;Set v = vars.Item(k)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;IF Left(v.Name, 2) = "v_" Then&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;MsgBox(v.Name)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;Else&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;End if&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;Next&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;End Sub&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;I hope this helps!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Good luck!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;DV&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://QlikShare.com"&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;www.QlikShare.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 24 Nov 2012 12:05:27 GMT</pubDate>
    <dc:creator>IAMDV</dc:creator>
    <dc:date>2012-11-24T12:05:27Z</dc:date>
    <item>
      <title>Variables and Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-and-Macro/m-p/463309#M699659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i access the Name of the variables that has been created in variable overview in macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using Following Macro Script but it is giving me name of the variables apart from i have created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set Vars = ActiveDocument.GetVariableDescriptions&lt;/P&gt;&lt;P&gt;For k = 0 to vars.Count - 1 &lt;/P&gt;&lt;P&gt;Set v = vars.Item(k)&lt;/P&gt;&lt;P&gt;MsgBox(v.Name)&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guys Please help .....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 20:04:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-and-Macro/m-p/463309#M699659</guid>
      <dc:creator />
      <dc:date>2012-11-23T20:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Variables and Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-and-Macro/m-p/463310#M699660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't found a property to distinguish a user defined variable from a system variable. The only thing I can think of is starting at 25 to skip the system variables:&amp;nbsp; For k = 25 to vars.Count - 1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Nov 2012 09:51:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-and-Macro/m-p/463310#M699660</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-11-24T09:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Variables and Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-and-Macro/m-p/463311#M699661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Hi Manish,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Gysbert is right... there is no inherit property to distinguish whether it's User or Sytem variables. However, if you can follow a standard naming convention while creating the variables then you can use string/ pattern search to identify whether its User or System variable. And this is good practice when you have more than handful of variables. I always follow a standard naming convention, something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;STRONG style="font-family: calibri,verdana,arial,sans-serif;"&gt;Generic Variables:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_HideShow&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_MyString&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_ConcatFieldValue&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;STRONG style="font-family: calibri,verdana,arial,sans-serif;"&gt;Expression Variables:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_Exp_TotalSales&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_Exp_AvgSales&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_Exp_MonthlySales&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;STRONG style="font-family: calibri,verdana,arial,sans-serif;"&gt;Colour Variables:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_Colour_Primary_01&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;v_Colour_Primary_02&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Once you follow the standard naming convention then you easily call your variables by using below script.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;Sub VariableNames&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;Set Vars = ActiveDocument.GetVariableDescriptions&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;For k = 0 to vars.Count - 1&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;Set v = vars.Item(k)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;IF Left(v.Name, 2) = "v_" Then&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;MsgBox(v.Name)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;Else&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;End if&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;Next&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;EM style="font-family: calibri,verdana,arial,sans-serif;"&gt;End Sub&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;I hope this helps!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Good luck!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;DV&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://QlikShare.com"&gt;&lt;SPAN style="font-family: calibri,verdana,arial,sans-serif;"&gt;www.QlikShare.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Nov 2012 12:05:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-and-Macro/m-p/463311#M699661</guid>
      <dc:creator>IAMDV</dc:creator>
      <dc:date>2012-11-24T12:05:27Z</dc:date>
    </item>
  </channel>
</rss>

