Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem updating multiple chart properties

Hi,

I have some macro code that is trying to update multiple chart properties.  Since I do not know in advance how many properties will be updated, I wrote code that updates a single property and I then call this code multiple times.  Each update does a GetProperties followed by a SetProperties.  Does anyone know why this approach does not work.  It appears that the subsequent "GetProperties" call gets the properties from the chart's original state, not the state set by the most recent SetProperties.  The following simple example demonstrates the problem:

sub UpdateProperties_DoesNotWork

  set objChart=ActiveDocument.ActiveSheet.CreatePivotTable

  set objProp=objChart.GetProperties

  objProp.TableProperties.AllowPivoting=False

  objChart.SetProperties objProp

  set objProp=objChart.GetProperties

  objProp.TableProperties.PivotAlwaysFullyExpanded=True

  objChart.SetProperties objProp

end sub

When executing this code, only the second property (Always Fully Expanded) will be set.  However, if I remove the "SetProperties/GetProperties" from the middle and update both properties together it works fine.

Because of my overall macro structure, I really need/want to be able to do multiple updates.  Any suggestions of why this is not working will be much appreciated,

I forgot to add - I am using QlikView 9 SR6.

John

1 Reply
johnw
Champion III
Champion III

You might need to use an ActiveDocument.GetApplication.WaitForIdle between one set and the next get to make sure that one thing finishes before the next thing begins.  The down side of this approach is that it will probably take significantly longer to finish the work as it single threads everything, and rebuilds the chart for every property you change.  A way around that is to add false() as a calculation condition when you start, then remove it at the end.  It'll still probably be slower, but at least it won't be rebuilding the chart over and over.  Or I could be completely off base about what might be causing the problem.