Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

How to identify which Object ID is active inside a container

I have a container with a number of charts displayed inside it. I would like to change the caption of the container depending on which chart is displayed.

If my charts had object ID's of CH01, CH02,CH03 CH04 is it posible to create a formula in the Caption of the container that does something like

If ObjectID=CH01 then "Title should be this"


I can't find a way to reference which is the active chart object inside the container.

12 Replies
ipauldur
Contributor

How to identify which Object ID is active inside a container

Hi,

I want to know the active object inside the container. Did you get any idea on this?

If yes, please share to me.

Thanks & Regards,

Durai.

Not applicable

Re: How to identify which Object ID is active inside a container

Durai

I haven’t had any answers on this one yet and I haven’t been able to figure it out on my own. If I do manage to work it I’ll post the answer so you can see it.

Mark

Partner
Partner

Re: How to identify which Object ID is active inside a container

Hello,

I have the same needs, I'd like to show an input box only if a given object is activated inside the container.

Can anyone help me to achieve it?

Many thanks & Best Regards

Andrea

flipside
Valued Contributor II

Re: How to identify which Object ID is active inside a container

Hi,

This can be done via macros ...

set CTObj = ActiveDocument.GetSheetObject("CT01")

set CTProp = CTObj.GetProperties   

MsgBox CTProp.SingleObjectActiveIndex

... but you have to be careful. If you re-order the objects, it doesn't seem to return the correct index until you add a new object. (For QV11 SR2 at least).

flipside

Partner
Partner

Re: How to identify which Object ID is active inside a container

Thanks flipside,  but the problem is how and when can I fire that macro ?

I'd like to enable conditional show on input box (outside the container) only if the container active object index is equal to 5.

Andrea

flipside
Valued Contributor II

Re: How to identify which Object ID is active inside a container

I think I'd be tempted to just use conditional show objects with their individual visibility controlled by a list box (set to one selected value). So, in script, create a table such as  ...

ListBox:

Load * inline [

ID

0

1

2];

Then overlay each of your objects with conditional show as ID=0, ID=1 etc.  You should be able to make this look a bit like a container except you wouldn't be able to minimize/maximize it and nothing can be Size to Data.

flipside

Partner
Partner

Re: How to identify which Object ID is active inside a container

ok this could be a workaround but I want to use the container object.

Regards

Andrea

flipside
Valued Contributor II

Re: How to identify which Object ID is active inside a container

The macro code for setting the active object is ...

sub ContainerControl_btnSelect

    set LB_ID = ActiveDocument.Fields("ID").GetPossibleValues

    set btnObj = ActiveDocument.GetSheetObject("CT01")

    set btnProp = btnObj.GetProperties   

    btnProp.SingleObjectActiveIndex = LB_ID.item(0).text

    btnObj.SetProperties btnProp

   

end sub

(This will set to minimum or first selected value of ID).

Then use a listbox with ID as the field overlaying the container object list and have a field trigger. Again has limitations on maximise/minimize.

I think this is less robust than the other workaround because of the container index jumping around.

flipside

Partner
Partner

Re: How to identify which Object ID is active inside a container

If I well understood the user don't clic on the container object tab but selecting a value from the listbox that contains (0, 1, 2, etc...)

Is that correct ?

Also I noted it's only works with IEPlugin no AJAX and that's the problem !!!

Andrea