Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is it possible to modify the conditional show of sheet and object by using macro ? Thanks for your help.
Ok, why you don't mark as "Answered"?
Yes, these are the steps:
1) Create a variable in Qlik called vShow
2) Go to your sheet properties, and under Show Conditional write =$(vShow)
3) Now create a button or go directly to your macro, and put the code:
sub Hide()
dim v
SET v = ActiveDocument.GetVariable("vShow")
v.SetContent "0",true
end sub
This will assign a 0 to the varible vShow. 0 is to hide an object (or sheet) and 1 is to show it.
Thank you qlikuser14 - But I would like to write the conditional show in many object with a dynamic condition.So is it possible tu use macro to write the condition in the properties of the object.Thanks
The logic is the same. Create different values for each object and then assign 0 or 1 to them.
lau, if i understand, you needo to do this without knowledge of how many objects you need... This is the kind of "Dynamic" condition?
You could do:
set chart = ActiveDocument.ActiveSheet.CreateBarChart
chart.AddDimension "Class"
chart.AddExpression "count(distinct Member)"
set cp = chart.GetProperties
cp.EvaluationCondition.v = "count(distinct Class)<5"
chart.SetProperties cp
Please, let me know if it was useful for you.
Thank you. It is exactly what I wanted - It seems QV doesn't know this syntax : cp.EvaluationCondition.v = !!!! Do you have any idea ?
It was an example. If you want to set the condition for the object "CH3", the code would be:
Sub EvConditionCH03
Set Obj=ActiveDocument.GetSheetObject("CH03")
Set cp=Obj.GetProperties
cp.EvaluationCondition.v = "{condition}"
Obj.SetProperties cp
End Sub
Tell me, what you need to do ?
Sorry, but EvaluationCondition is not the ShowCondition. Do you know how to change the Show Condition ?
Try:
Sub EvConditionCH03
Set Obj=ActiveDocument.GetSheetObject("CH03")
Set cp=Obj.GetProperties
cp.Layout.Frame.Show.Always = false
cp.Layout.Frame.Show.Expression.v = "{condition}"
Obj.SetProperties cp
End Sub
If doesn't works, could you tell me what you need to do?
Thanks Sebastian - It is working great on tab object but doesn't work on Graph object - Do you have any idea ?