Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
pover
Luminary Alumni
Luminary Alumni

Change Expression Comment with Macro

Is it possible to add a comment to an expression with a macro?  I see a function call Comment defined within the iExpressionData class, but there is no example and when I try the following

set chart = ActiveDocument.getSheetObject("ReportBuilder")

set chartProperties = chart.GetProperties

set chartExpressions  = chartProperties.Expressions

set chartExpression = chartExpressions.Item(j).Item(0).Data

chartExpression.ExpressionVisual.Label.v = Metric & "(This)"

chartExpression.ExpressionData.Comment.v "='$(" & Metric & ")'"

I get an error that this property or method does not exist.  I've tried with and without the ".v".  Has anybody been able to add a comment by using a macro?

Thanks, Karl

1 Solution

Accepted Solutions
jerrysvensson
Partner - Specialist II
Partner - Specialist II

Hi

This worked for me:

sub test

set chart = ActiveDocument.GetSheetObject("CH30")

set p = chart.GetProperties

set expr = p.Expressions.Item(0).Item(0).Data.ExpressionData

expr.Comment = "sum(Amount)"

chart.SetProperties p

end sub

View solution in original post

1 Reply
jerrysvensson
Partner - Specialist II
Partner - Specialist II

Hi

This worked for me:

sub test

set chart = ActiveDocument.GetSheetObject("CH30")

set p = chart.GetProperties

set expr = p.Expressions.Item(0).Item(0).Data.ExpressionData

expr.Comment = "sum(Amount)"

chart.SetProperties p

end sub