There is an old discussion related to this in the archive. Unfortunately, the attachment is not available and the proposed solution in the text does not seem to work. Does anyone know how to accomplish the following.
I am trying to add the following calculated dimension to a chart via a macro:
The macro doesn't stop on the .adddimension statement:
Sue, In fact, I am using AddDimension for the calculated dimensions in a production application, and it does work. You problem is apparently somewhere else. First of all, add the "=" beforethe "if". The definition of the calculated dimension in the macro must be exactly the same as if you created it manually.
I've tried it both with / without the equal sign. No luck. It just seems to ignore the calculated dimension and doesn't add it at all. I'm going to try uploading a sample of this. Would you mind taking a look at it or trying it on your machine?
I had a similar problem in the past. I whipped up a quick macro that uses AddDimension. Here it is:
SUB Test set chart = ActiveDocument.GetSheetObject("CH53")
chart.AddDimension "FIELD" END SUB
The problem is that the dimension will be added, but will not appear on the chart. If I open the Properties window, it is in the Dimension list. When I click Ok, the chart will refresh and I see the Dimension.
If I do the GetProperties/SetProperties thing around the AddDimension line, nothing will be added to the chart.
I thought I discussed this problem in another thread, so I'm going to take a look and see if there was a good solution. EDIT: This may be the thread I was thinking of: http://community.qlik.com/forums/t/16449.aspx. The user was having problems with an AddDimension in a long macro and doing the AddDimension in a separate subroutine (or I think simply rearranging the macro) seemed to fix the issue.