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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Referencing multiple objects

Is there a way to group objects together in a way that they can be referenced by something other than their ID's? Essentially I'm looking for something akin to a CSS class if you're familiar with web development.

Here's what I'm trying to accomplish: I have a button "Exclude Deceased" that's going to occur on all sheets of my application that runs a macro I've written. Part of that macro changes the properties of the button (bgcolor, text, etc.) so you know it's been activated and you're able to toggle it on and off to exclude/include deceased. I'd like to have that apply to all instances of the button on all sheets, so if I hit it on the first sheet and I navigate to the last sheet it will still display as activated.

I know I can do this by just hard coding the ID of each button in the macro but I wanted to check to see if there's another way, especially since this is one of 3 buttons I'll be trying to do this with, and at this point the application has 14 sheets.

Also, apologies if this has been discussed elsewhere, my searching didn't come up with anything.

Thanks!

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

I don't think it's possible. Maybe in version 10, as I hear it has object grouping of some sort, but I haven't downloaded and experimented with it.

Instead of setting the button properties in the macro, you could just set a variable. The buttons could check the variable in expressions that set the background color, text, etc.

Alternatively, "exclude deceased" sounds a whole lot like a field to me, and if it isn't a field, it could perhaps be made one. On the surface, this doesn't sound like something you'd need a macro for at all. For instance, have an "Exclude Deceased" field with value 'Exclude Deceased' on all living entities, and null on all deceased entities. Make a list box, set the style to windows checkboxes, and remove the caption. Now you have a checkbox that excludes deceased when checked. Just a thought. Probably plenty of other ways to handle it too. But then, I have no idea what else your macro does, and it could be doing a lot more than just excluding deceased in a field association sense.

View solution in original post

3 Replies
johnw
Champion III
Champion III

I don't think it's possible. Maybe in version 10, as I hear it has object grouping of some sort, but I haven't downloaded and experimented with it.

Instead of setting the button properties in the macro, you could just set a variable. The buttons could check the variable in expressions that set the background color, text, etc.

Alternatively, "exclude deceased" sounds a whole lot like a field to me, and if it isn't a field, it could perhaps be made one. On the surface, this doesn't sound like something you'd need a macro for at all. For instance, have an "Exclude Deceased" field with value 'Exclude Deceased' on all living entities, and null on all deceased entities. Make a list box, set the style to windows checkboxes, and remove the caption. Now you have a checkbox that excludes deceased when checked. Just a thought. Probably plenty of other ways to handle it too. But then, I have no idea what else your macro does, and it could be doing a lot more than just excluding deceased in a field association sense.

Not applicable
Author

Thanks John, this is very helpful. After posting this I thought briefly about the variable thing but figured I'd wait to see if there was an easier way.

As you suspected it is in fact a field and I'm sure what you suggest would work, however for the sake of making the decision to exclude/include deceased as big and obvious as possible I think our department is more or less married to the "Big Bright Button" idea. It's also been a useful learning tool for me to get a handle on macros in general.

johnw
Champion III
Champion III

I guess I just try to avoid macros these days due to the maintenance complexity and the performance problems they can cause. I'm thinking of two options. First is to build a big bright "button" out of a list box with some formatting tricks. It won't have the glassy effect of a real button, but I don't think it's too bad. Or you can do a real button, but just use an action (or macro in 8.5) that does nothing but toggle the field value. Drive everything else off the field value being selected. See attached example of both approaches.