<?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 Set Variable with Value of Row Count using Macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Variable-with-Value-of-Row-Count-using-Macro/m-p/362577#M704133</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an object that I don't display within QlikView. It's designed so that a user makes several filters in other objects and then exports this data set to Excel. But I would like to put in some safeguards so that they can't export 100k rows of data and I want this to display a message so they know why the export did not take place. I've been playing around with the following Macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;Sub&lt;/STRONG&gt;&lt;/SPAN&gt; ExportToExcel&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;Set&lt;/STRONG&gt;&lt;/SPAN&gt; chart = ActiveDocument.GetSheetObject(&lt;SPAN style="color: #1e39f6;"&gt;"CH668"&lt;/SPAN&gt;)&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;Set&lt;/STRONG&gt;&lt;/SPAN&gt; p = chart.GetProperties&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;Set&lt;/STRONG&gt;&lt;/SPAN&gt; v = ActiveDocument.Variables(&lt;SPAN style="color: #1e39f6;"&gt;"vCount"&lt;/SPAN&gt;)&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;If&lt;/STRONG&gt;&lt;/SPAN&gt; getVariable = v.GetContent.&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;String&lt;/STRONG&gt;&lt;/SPAN&gt; &amp;gt; 100 &lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;Then&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #1e39f6;"&gt;&lt;STRONG&gt;MsgBox&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;(&lt;/SPAN&gt;"Please Limit Export to 100 Records"&lt;SPAN style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #1e39f6;"&gt;&lt;STRONG&gt;Else&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;chart.SendToExcel&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #1e39f6;"&gt;&lt;STRONG&gt;END&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;If&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #1e39f6;"&gt;&lt;STRONG&gt;END&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;Sub &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So I have a button which has an action to Run a Macro ("ExportToExcel"). I want it to check the objects' properties, get the row count, store that in a variable ("vCount"), then based on the size of that variable (10, 100, 1000, etc) be able to determine if it should send to Excel. And if it's too large to send to Excel to present a message to the user to limit their selections.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Josh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jun 2012 13:52:37 GMT</pubDate>
    <dc:creator>jcampbell</dc:creator>
    <dc:date>2012-06-21T13:52:37Z</dc:date>
    <item>
      <title>Set Variable with Value of Row Count using Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Variable-with-Value-of-Row-Count-using-Macro/m-p/362577#M704133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an object that I don't display within QlikView. It's designed so that a user makes several filters in other objects and then exports this data set to Excel. But I would like to put in some safeguards so that they can't export 100k rows of data and I want this to display a message so they know why the export did not take place. I've been playing around with the following Macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;Sub&lt;/STRONG&gt;&lt;/SPAN&gt; ExportToExcel&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;Set&lt;/STRONG&gt;&lt;/SPAN&gt; chart = ActiveDocument.GetSheetObject(&lt;SPAN style="color: #1e39f6;"&gt;"CH668"&lt;/SPAN&gt;)&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;Set&lt;/STRONG&gt;&lt;/SPAN&gt; p = chart.GetProperties&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;Set&lt;/STRONG&gt;&lt;/SPAN&gt; v = ActiveDocument.Variables(&lt;SPAN style="color: #1e39f6;"&gt;"vCount"&lt;/SPAN&gt;)&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;If&lt;/STRONG&gt;&lt;/SPAN&gt; getVariable = v.GetContent.&lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;String&lt;/STRONG&gt;&lt;/SPAN&gt; &amp;gt; 100 &lt;SPAN style="color: #1e39f6;"&gt;&lt;STRONG&gt;Then&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #1e39f6;"&gt;&lt;STRONG&gt;MsgBox&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;(&lt;/SPAN&gt;"Please Limit Export to 100 Records"&lt;SPAN style="color: #000000;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #1e39f6;"&gt;&lt;STRONG&gt;Else&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;chart.SendToExcel&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #1e39f6;"&gt;&lt;STRONG&gt;END&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;If&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #1e39f6;"&gt;&lt;STRONG&gt;END&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;Sub &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So I have a button which has an action to Run a Macro ("ExportToExcel"). I want it to check the objects' properties, get the row count, store that in a variable ("vCount"), then based on the size of that variable (10, 100, 1000, etc) be able to determine if it should send to Excel. And if it's too large to send to Excel to present a message to the user to limit their selections.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Josh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 13:52:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Variable-with-Value-of-Row-Count-using-Macro/m-p/362577#M704133</guid>
      <dc:creator>jcampbell</dc:creator>
      <dc:date>2012-06-21T13:52:37Z</dc:date>
    </item>
  </channel>
</rss>

