Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.


Set Variable with Value of Row Count using Macro

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:

Sub ExportToExcel

Set chart = ActiveDocument.GetSheetObject("CH668")

Set p = chart.GetProperties

Set v = ActiveDocument.Variables("vCount")

If getVariable = v.GetContent.String > 100 Then

MsgBox("Please Limit Export to 100 Records")





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.

Any ideas would be greatly appreciated.



Community Browser