12 Replies Latest reply: Mar 6, 2015 9:16 AM by Kezban Mutlu RSS

    Automatic Button

      Hi,

       

      Does anyone know how can I do something automatic in qlikview? It is that

      In pivot table, you know there are dimensions hided in + and we expand it all to be able to see each dimension further. My question is is there a way to do it automatically expanded in a simple button instead of doing it manually? Maybe in macro or similar...?

       

      Many thanks in advance,

       

      Cheers

       

      Kezban

        • Re: Automatic Button
          Andrew Whitfield

          Hi Kezban,

           

          See the following post:

           

          http://community.qlik.com/thread/102959

            • Re: Automatic Button

              Hi Andrew,

               

              I am very thankful and grateful for your prompt response. Thank you.

               

              Cheers

              Kezban

                • Re: Automatic Button
                  Andrew Whitfield

                  Hi Kezban, it this was the correct solution, can you please marked the post as answered?

                   

                  Thanks

                   

                  Andy

                    • Re: Automatic Button

                      Hi Andrew ,

                       

                      I am thankful for the code I have received about pivot expanding and collapsing macro. However , I want to make it run when i qlik on to button to expand and for another button when i qlick it to collapse. Qlikview does not understand it or maybe I dont know how to do it. Do you have any advice for it?

                       

                      Many thanks,

                       

                      Cheers

                        • Re: Automatic Button
                          Andrew Whitfield

                          There is another neat why of doing it without macros, see the pivot charts on the "Conditional(Dynamic) Columns" sheet of the attached qvw

                            • Re: Automatic Button

                              Hi Dear Andrew,

                               

                              I am more than grateful for your response with very helpful tutorial. It works perfect in my project now. It expands all and collapse all. That is perfect. However, the only thing I wanna do that when I qlik the button to collapse, the pluses ( + ) dissepear. I really want them to stay and just expand and collapsed. Now they dissepear and I lose my will to select if I dont wanna use the button. There might be other way like running macro but I may not know some details to work like with + s. In this project I got, would be nice if I would be able to work it well and could still see pluses.

                              Would you have any advice for that?

                               

                              Many thanks, Feeling lucky to have that professional environment in here as I'm kinda newbie for qlikview.

                               

                              Cheers

                               

                              Kezban

                    • Re: Automatic Button
                      Andrew Whitfield

                      Hi Kezban,

                       

                      this is a better macro:

                       

                      Sub ExpandChart
                      'This macro fully expands the selected pivot table.
                        On Error Resume Next

                       

                        Set vChartToExpand = ActiveDocument.Variables("vChartToExpand")
                        Set chart = ActiveDocument.GetSheetObject(vChartToExpand.GetContent.String)
                        Set gp = chart.GetProperties
                        gp.TableProperties.PivotAlwaysFullyExpanded = TRUE 'not gp.TableProperties.PivotAlwaysFullyExpanded
                        chart.SetProperties gp
                      End Sub


                      Sub CollapseChart
                      'This macro allowse collapsing of the selected pivot table.
                        On Error Resume Next

                       

                        Set vChartToExpand = ActiveDocument.Variables("vChartToExpand")
                        Set chart = ActiveDocument.GetSheetObject(vChartToExpand.GetContent.String)
                        Set gp = chart.GetProperties
                        gp.TableProperties.PivotAlwaysFullyExpanded = FALSE 'not gp.TableProperties.PivotAlwaysFullyExpanded
                        chart.SetProperties gp
                      End Sub

                       

                      You need to create a variable vChartToExpand that contains the chart ID and 2 buttons, one for expand and one for collapse, you will see the +/- when the chart is Collapsed, but NOT when its fully expanded, there's no way round this..

                        • Re: Automatic Button

                          Hi Andrew,

                           

                          I just would like to sum it up  below:

                           

                          I have 2 sub expand and sub collapse macros. So I will write them down in a action inside the button with run macro section. Right? I hope that should be enough. Becuse ,it works all together it doesnt understand when collpase when to expand. I have good knowledge of excel macros but not the same in qlikview. Then I have doubts on variable:

                          vChartToExpand : what should i type inside in expression of this variable? You said chart ID 2 buttons. The only thing I am stuck on now.

                           

                          Many thanks...

                           

                          Kezban