Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
wnorwood
Contributor III
Contributor III

Change Dimension Label in VB Macro

Hello,

I have the followin gcode to change the label for Expressions in a Straight Table using VB macro (QV 10). 

'rename an expression label
set p = chart.GetProperties
set exps = p.Expressions
set expItem = exps.Item(i).Item(0).Data.ExpressionVisual
expItem.Label.v = expSelection.Item(i).Text

I need to be able to do the same for my dimensions.  But, I cannot seem to make it work for dimension labels.  Can anyone direct me to the appropriate code?

Thanks.

1 Solution

Accepted Solutions
wnorwood
Contributor III
Contributor III
Author

I was able to piece an answer together myself using information in the following discussion:

http://community.qlik.com/thread/33307

My final code is:

set dimSelection = ActiveDocument.fields("Dimension").GetPossibleValues
set dimName = ActiveDocument.fields("DimensionName").GetPossibleValues
for i=0 to dimSelection.Count - 1
chart.AddDimension dimSelection.Item(i).text
'rename an expression label
set p = chart.GetProperties
set dims = p.Dimensions(i)
dims.Title.v = dimName.Item(i).Text
chart.SetProperties p
SET p=Nothing

Thanks!

View solution in original post

1 Reply
wnorwood
Contributor III
Contributor III
Author

I was able to piece an answer together myself using information in the following discussion:

http://community.qlik.com/thread/33307

My final code is:

set dimSelection = ActiveDocument.fields("Dimension").GetPossibleValues
set dimName = ActiveDocument.fields("DimensionName").GetPossibleValues
for i=0 to dimSelection.Count - 1
chart.AddDimension dimSelection.Item(i).text
'rename an expression label
set p = chart.GetProperties
set dims = p.Dimensions(i)
dims.Title.v = dimName.Item(i).Text
chart.SetProperties p
SET p=Nothing

Thanks!