Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
AbhijitBansode
Specialist
Specialist

Container Object,Selected Index Change

Hi All,

I want to enable or disable the button when index of container object change.

e.g. container object contains bar and pie charts , when pie chart is selected ,

button to change group bar chart into stack bar chart should be disable and vice versa.

i can enable or disable this button by checking currently active index of container obeject,

by using SingleObjectActiveIndex property. but i'm not getting where should i fire this trigger(macro).

Is there any event which can track when Index Of Container Object changes..

Please sugegst some ideas, how should i achieve the same?

1 Solution

Accepted Solutions
Not applicable

I fired the trigger, with your macro code, on the trigger page of the sheet, there you can trigger a even on activating an object (CT01). This works fine!

But would be nice if Qlikview can make triggers on the object, tabs etc.

View solution in original post

17 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   You can use container properties to find the object id of the object it contains.

   Go to API Guide(C:\Program files\Qlikview\Documentation) in your computer and visit Automation Example sheet.

   class = IcontainerProperties and Member is Containedobject.

    When you click on this you will find the example too.

    Hope this will help you.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
AbhijitBansode
Specialist
Specialist
Author

Kaushik, thank you  for concern.

I think, I've nt explained my probem properly.

I'm able to get contained objects of Container,

below is my macro code and it is working properly:

Set ContainerObj= ActiveDocument.GetSheetObject("CT01") '

             

              set ContProp=ContainerObj.GetProperties       

              'get index of currently active tab/object of container

              activeIndex= ContProp.SingleObjectActiveIndex

             

              'get the button object which is use to switch bar chart between group->stack and vice-versa

              set button =ActiveDocument.GetSheetObject("BU01")

              set prop = button.GetProperties       

             

              if activeIndex=0 then                      'if Container displays Bar chart

                prop.EnableCondition.v = "1"        

               else                                             'if container displays Pie chart

                 prop.EnableCondition.v = "0"

              end if     

             

              button.SetProperties prop  

             

              ContainerObj.SetProperties ContProp

this code do the work, but i'm not getting from where should i fire(trigger) trigger this macro.

I hope , this time i'm clear..

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    First thing place this code in between this two lines

    sub your_macro_name

          ....code here

     End sub

     then,       

All you have to do is create a button.

    Go to properties of button -> Action Tab -> Click on Add Action -> Select External -> Select Macros -> Assign the macro name.

    This will sove your problem.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
AbhijitBansode
Specialist
Specialist
Author

Hi Kaushik,

I forget to include Sub and End Sub in above mentioned code.

but i've used it in my code.

I don't want to trigger this code on any button, when user changes object in the container object only then it should be fired.

please refer attached screen shot.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Have a look at this example.

    I have done something which you want but in different manner.

    Hope this will help you.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
AbhijitBansode
Specialist
Specialist
Author

Hi Kaushik,

gone throug your example , but this is not the one i really wanted.

also i didn't find any container object in it.

please refer the attached app.

hope u are aware of Container Object in QV10.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Let me tell you what i undertood from your explaination.

   You want to hide group button when you click on pie chat and you want it to be back when you click on barchart.

   According to this i have sent you an example where i tried to do the same without container object.

   The reason of not using container was you cant have any action on the objects placed in container.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
AbhijitBansode
Specialist
Specialist
Author

Your understanding is totally correct Kaushik.

I know that Objects placed in Container do not have any action..

but accroding to my requirement, I have to Use Container object.

So need some workaround for this.

Anyone, any idea?

Not applicable

I am also interested in this behavior,

How to set trigger on tab selection of a container.

Abhijit, I could not reuse your macro code, as it fails with the following error message:

Object doesn't support this property or method: 'ContProp.SingleObjectActiveIndex'

I could not find this property as well from the API Guide.