Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a requirement to automate the process of exporting the charts to PPT and excel.
For the same, I have written a macro, which will directly take all the inputs to create a chart from a config file and create the charts on the fly.
I am facing a problem while adding dimensions and Expressions to the chart.
Could you please help me by letting me know whether there is a possibility to add the dimensions using a variable.
Please note that the variable is not defined in Qlikview, rather it is local to the macro script.
Example:
set chart = ActiveDocument.Activesheet.CreateStraightTable
chart.AddDimension "Product"
chart.AddExpression "sum(Amount)"
The above works fine, but if I want the dimensions and Expressions to be stored in a variable, it is causing issue.
Dim testDimension,testExpression
set testDimension="Product" '(In the actual solution these will be fetched from the config file on the fly)
set testExpression= "sum(Amount)"
set chart = ActiveDocument.Activesheet.CreateStraightTable
chart.AddDimension testDimension
chart.AddExpression testExpression
Please let me know a way to read the variables as Dimensions and Expressions.
Thanks in advance!
Nidhi
These dimensions/expressions variables contain only strings and are no objects and should be therefore not declared with "set". I'm not sure if Qlik needs here the double-quotes arounds the variable but you could try it if it's not working so far with:
...
chart.AddDimension chr(34) & testDimension & chr(34)
...
- Macus