Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

movva365
Contributor

Conditional hide column in Pivot table

HI

I am working on a financial dashboard where in it has Group Name, Account,Actual ,Budget ,variance column for Period Year to Date and Full year respectively, Now as the data is not available still for Full year I want to Hide Actual Column for Full Year, When am trying to hide Actual by writing false() or 0 in Condition expression it is hiding the entire Actual column ie also for Period & Year to Date, I just want to Hide Actual Column for Full Year, Is this possible,

I searched on line for this and found some macro to hide the column by adjusting width to 0 but couldn't able to understand where to put that code or how to use, Can any one please help me in this

Attaching

Thanks a lot for your help

4 Replies
krishna20
Valued Contributor

Re: Conditional hide column in Pivot table

Hi ,

Use the below code in the macros window

sub Squeeze

call HideColumn("CH01", 2)

end sub

'

private sub HideColumn(ch, n)

set ch = ActiveDocument.GetSheetObject(ch)

ch.SetPixWidth (n-1), 0

end sub

Goto Tools in the Menu bar-> Select Edit Module

Then paste the above code in the window. Give your sheet ID at Hide column as well as column no.

Hope this helps.

movva365
Contributor

Re: Conditional hide column in Pivot table

Hi thanks a lot for your quick response, As suggested I copied the code given and pasted with the sheet id and chart id and column number as suggested, But it is failing when I try to check the code My sheet id is SH04 and chartID is CH06 and column number is 11

sub Squeeze

call HideColumn("CH06", 11)

end sub

'

private sub HideColumn(SH04,11)

set ch = ActiveDocument.GetSheetObject(ch)

ch.SetPixWidth (n-1), 0

end sub

Can you please correct me where am going wrong

Thank you

movva365
Contributor

Re: Conditional hide column in Pivot table

And when I click on Test underneath the GoTo button it says Object required: 'ch' and highlights ch.SetPixwidth (n-1),0

This happens when I paste this code

sub Squeeze

call HideColumn("SH04", 11)

end sub

'

private sub HideColumn(CH06,N)

set ch = ActiveDocument.GetSheetObject(ch)

ch.SetPixWidth (n-1), 0

end sub

Not applicable

Re: Conditional hide column in Pivot table

How do you reverse this macro? I.e. how do you unhide the column you just hid?

Community Browser