Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Modify Conditional Show

Is it possible to modify the conditional show of sheet and object by using macro ? Thanks for your help.

1 Solution

Accepted Solutions
sebastiandperei
Specialist
Specialist

Ok, why you don't mark as "Answered"?

View solution in original post

14 Replies
jvitantonio
Luminary Alumni
Luminary Alumni

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.

Not applicable
Author

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

jvitantonio
Luminary Alumni
Luminary Alumni

The logic is the same. Create different values for each object and then assign 0 or 1 to them.

sebastiandperei
Specialist
Specialist

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.

Not applicable
Author

Thank you. It is exactly what I wanted - It seems QV doesn't know this syntax : cp.EvaluationCondition.v = !!!! Do you have any idea ?

sebastiandperei
Specialist
Specialist

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 ?

Not applicable
Author

Sorry, but EvaluationCondition is not the ShowCondition. Do you know how to change the Show Condition ?

sebastiandperei
Specialist
Specialist

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?

Not applicable
Author

Thanks Sebastian - It is working great on tab object but doesn't work on Graph object - Do you have any idea ?