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

Text object condition based on chart object minimised/maximised status

Hi,

I'm trying to set a show condition for a text box based on whether a chart is minimised or not. I can't seem to find any way to do this? I'm assuming I might need to create a macro to reference the object minimised status?

As anyone got any examples of achieving this?

Thanks
Nick

1 Solution

Accepted Solutions
Not applicable
Author

in the if statement in the conditional box the the text needs to be in single speach marks.

e.g 'Max'

not "Max"

thats my fault sorry.

i had it set up to run the macro at every possible oportunity, sheet activate/deactive and object activate/deactivate.

but if you minimise something then it wont change until you select another object so its not perfect.
as when you select the object the macro runs, and as it runs the object is still maximised. it then minimises but the macro wont run until you select another object.

i cant find anywhere to call the macro like onMaximise or onMinimise.

View solution in original post

9 Replies
Not applicable
Author

http://community.qlik.com/forums/t/31501.aspx

i posted a similar question a week or 2 ago.

the best solution we could come up with was a macro that looks at the minimize/maximise status of the object and sets a variable accordingly

the variable could then be used in the show condition(multiple text boxes). or to set the text in the text box its self.(1 text box showing different text depending on the variable)

the problem was making the macro run, you can set it to run when the object is activated or deactivated but not minimised or maximised.
my suggestion was some sort of delay in the macro.

look at the examples in the post above.

Not applicable
Author

Thanks for that and you're right. I'm hitting the same issues as you did on the min/max of the objects.

As I'm quite new to using macros, how would I define a variable in the macro that I could then reference in the conditional show of the text object (as you have done)?

Thanks again

Nick

Not applicable
Author

Hi nick,

Whay i did was created the variable called "aVis" in Settings > Variable Overview.

then used this code in the macro



Sub Eth
Set v = ActiveDocument.Variables("aVis") 'picks up the variable
Set A=ActiveDocument.GetSheetObject("CH02") ' pick up the chart object for checking its min/max.
s = v.getContent. String 'gets the value of the variable as a string
if A.isMaximised then 'if the chart is maximised
varContent = "aMax"
v.setContent varContent, true 'set the content to "aMax"
end if
'put in more conditions and outputs etc,
end sub


then use the in the text object,

if(aVis = "aMax",-1,0)
// -1 returns as true and 0 as false so if the variable = "aMax" then the statement returns -1 and the text object will show.



Not applicable
Author

I've built this new macro using the variable. When I call the macro from the sheet activate I can see that the variable value is changing correctly between "Max" and "Min", which is great. However...

1. The conditional on the text box isn't working. I've emulated what you've done, but the text box remains hidden no matter what. When does this conditional get checked on the text box control? I've tried calling the macro from the text box itself too just to see if that made any difference - but it didn't.

2. Possibly the answer to the first point, but where do you recommend calling the macro above? The sheet activate/deactivative is really going to work, neither will the chart activate/deactivate.

Think I'm still a bit unclear on how the events chain together in Qlikview!!

Thanks for your ongoing help, I'm getting there..!

Nick

Not applicable
Author

in the if statement in the conditional box the the text needs to be in single speach marks.

e.g 'Max'

not "Max"

thats my fault sorry.

i had it set up to run the macro at every possible oportunity, sheet activate/deactive and object activate/deactivate.

but if you minimise something then it wont change until you select another object so its not perfect.
as when you select the object the macro runs, and as it runs the object is still maximised. it then minimises but the macro wont run until you select another object.

i cant find anywhere to call the macro like onMaximise or onMinimise.

Not applicable
Author

Yep, that's it - all working now (well, as best it can without the OnMaxmise/OnMinimise events anyway!).

Thanks for you help in working me through this, much appreciated!

graham-crooks
Contributor III
Contributor III

I wanted to discover if changing object titles was possible depending on minimised/maximised state.

In part, this has been raised as an Idea here: http://community.qlik.com/ideas/1529

but it needs Votes.

Anonymous
Not applicable
Author

Hello Nick, I have a similar challenge with my new application. Can you please suggest what changes you did to the macro code to get it to work?

Not applicable
Author

HI Sanchez ,

Thanks for the solution ,

But can we include more than one object's Min or Max Condition and set the variable -

If so can you share the code for the same plzz - as i am new to Qlikview

Appreciate the Help

Thanks,
Sai