Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

QlikView Pivot Table Expand/Collapse

hi, i am new at QV and is my first post here.


i need to know if is possible to automatize collapsing and expanding of column in pivot table (the same to right click on the top of table and click on "expand all" or "collapse all".)

if i select level 3 of 7 the level under that should be collapse (i should see the button)  and if i click on one of that should working as normal pivot table.

i need to have all level (i mean that i can't hide column as the value of a variable)

thanks in advance

3 Replies
Anonymous
Not applicable
Author

Hi,

Try this Macro:

  1. Sub ShowHideExpression() 
  2.   SET chartObj = ActiveDocument.GetSheetObject("CH01"
  3.   SET chartProp= chartObj.GetProperties 
  4.  
  5.   SET expr = chartProp.Expressions.Item(1).Item(0).Data.ExpressionData 
  6.   expr.Enable = False // Hides First expression 
  7.  
  8.   SET expr = chartProp.Expressions.Item(2).Item(0).Data.ExpressionData 
  9.   expr.Enable = True // Displays Second expression 
  10. End Sub 

Hope it helps!!

Not applicable
Author

hi,
i found this code but doesn't work.. (i am new and i have problem to adapt)
anyhow i understand that the code is for show or hide Expression... i need something to collapse or espande Dimension of pivot table.

if you can write the reference of the instruction to understand i thank you so much, i like to learn something new.

thanks

prashantbaste
Partner - Creator II
Partner - Creator II

Hi

If you have button / text box for "3-7 Level", you can set action to run Macro with Macro Name - "ExpandAll".

Try below macro -

Sub ExpandAll

        CollapseExpandPivot("CH01")

End Sub

Function CollapseExpandPivot (objectID)

Set chart = ActiveDocument.GetSheetObject(objectID)

        set ch=chart.GetProperties

        If ch.TableProperties.PivotAlwaysFullyExpanded =false then

                ch.TableProperties.PivotAlwaysFullyExpanded=true

                chart.SetProperties ch

        Else

                ch.TableProperties.PivotAlwaysFullyExpanded=false

                chart.SetProperties ch

        End If

End Function

Hoe this will resolve your issue.

--

Regards,

Prashant P Baste