2014-10-22 68 views
-1

在Qlikview中,我有多个过滤器。例如,让我们说3个过滤器,每个过滤器有3个可能的选择。这会给我总共27个可能的选择。在Qlikview中导入所有可能的字段选择并导出图表

我想写一个循环遍历所有这27个选择的宏,并将所有这些组合的报告中的图表导出到27张不同工作表的Excel工作簿中。

回答

0

您可以在QlikView中使用VBScript来实现此目的,但是,QlikView没有自动将图表图像导出到Excel的API。但是,Stefan Walther已经编写了一套出色的VBScript方法来帮助将图表导出到Excel中,同时支持图像和数据格式。

你可以找到他的文章和代码在这里:http://www.qlikblog.at/971/qliktip-32-exporting-multiple-objects-single-excel-document/

虽然上面盖出口固定图表Excel,您也想进行选择,所以我把东西一起为你下面,你可以结合使用与Stefan的出口代码:

Sub ExportCharts() 

set field1Values = ActiveDocument.Fields("<your first field here>").GetPossibleValues 
set field2Values = ActiveDocument.Fields("<your second field here>").GetPossibleValues 
set field3Values = ActiveDocument.Fields("<your third field here>").GetPossibleValues 

chartList = ActiveDocument.ActiveSheet.GetGraphs 

for i = 0 to field1Values.Count - 1 
    for j = 0 to field2Values.Count - 1 
     for k = 0 to field3Values.Count - 1 
      ActiveDocument.ClearAll() 
      ActiveDocument.Fields("<your first field here>").Select field1Values.Item(i).Text 
      ActiveDocument.Fields("<your second field here>").Select field1Values.Item(j).Text 
      ActiveDocument.Fields("<your third field here>").Select field1Values.Item(k).Text 

      ' ... export operations here... 

     next 
    next 
next 

end Sub