Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
i to set background color of an Expression of a straight table in my macro. i can do it for an pivot table but the same code dosn't function in a straight table.
Best Regards
Peyman
syntax would be... set chart = ActiveDocument.Activesheet.CreateStraightTable chart.AddDimension "ProductType" chart.AddExpression "sum(Amount)" set cp = chart.GetProperties set expr = cp.Expressions.Item(0).Item(0).Data set bce = expr.AttributeExpressions.BkgColorExp bce.Definition.v = "if(ProductType='Soap', red(), yellow())" chart.SetProperties cp
Hi
Use the macro to set a variable and then use the variable to set the color in the background color expression :
if variable=1 then colorRED else colorBLUE
otherwise this will help you a lot :
Properties -> Expressions -> click on the + next to the expression -> background color -> put something like rgb(255,100,100) in the definition box.
Thank you so much giakoum,
but i create my Expressions in my macro. this means there is no Expression that i can set the variable as BGColor. So i need to set the variable in BGColor property in my macro and this is the same problem i had at first.
Best Regards
Peyman
this will help you a lot :
Dear Shiva,
please note that i have said i need to do this in macro, using VBScript language. The way you have mentioned is correct but only works in Interface.
Best Regards
Peyman
In that case, follow the link below. There are much examples to set color using macros. Hope it will be helpfull for you. http://community.qlik.com/qlikviews/1137
syntax would be... set chart = ActiveDocument.Activesheet.CreateStraightTable chart.AddDimension "ProductType" chart.AddExpression "sum(Amount)" set cp = chart.GetProperties set expr = cp.Expressions.Item(0).Item(0).Data set bce = expr.AttributeExpressions.BkgColorExp bce.Definition.v = "if(ProductType='Soap', red(), yellow())" chart.SetProperties cp
Thank you so much Shiva,
it's the correct answer.
Best Regards
Peyman
Thnak you giakoum,
the QVW is great and is really useful for setting properties in chart.
Best Regard
Peyman