Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
sona_sa
Creator II
Creator II

Correction in macro

Hi,

I have a multibox, there is 100 value, What I want, Whatever value is selected there, That is my dimesion and I want to chage the color of background of selected dimension in my Multibox.

Please correct this macro so I can use the same

Sub GetSelected()

x=ActiveDocument.GetSheetObject("MB04").GetRelevantSelections

COLUMN_NAME=x(0)

Cstr(COLUMN_NAME)

id=Right(Cstr(COLUMN_NAME),len(Cstr(COLUMN_NAME))-12)

set chart = ActiveDocument.GetSheetObject("CH28")

set cp = chart.GetProperties

set expr = cp.Expressions.Item(0).Item(0).Data

set bce = expr.AttributeExpressions.BkgColorExp

bce.Definition.v = "if(COLUMN_NAME='STATE_CD', red(), yellow())"

chart.SetProperties cp

End Sub

Thanks

1 Reply
marcus_sommer

Generally this macro worked - where is the problem? I suggest another way to extract the selected value like this:

id=x(0)

id = mid(id, instr(id, chr(9)))

'msgbox id

Furthermore it don't need a macro for this. per field-functions like getfieldselections(), getselectedcount() directly in the attribute expression could the same achieved.

- Marcus