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

Minimum width on empty "divider" column?

Hi All

I have a straight table with divider columns every 3 columns, that is I have an empty column coloured black.

My problem is that these columns have a minimum width and I cant shrink them any smaller. Doeas anyone know of a setting that will allow me to reduce the columns further?

Thanks

Dominic

1 Solution

Accepted Solutions
Not applicable
Author

Hi.

Try to use a VB macro (which will be triggered on document open or on activate sheet):

Sub example

set chart = ActiveDocument.GetSheetObject("CH01")

set p = chart.GetProperties

set expr = p.Expressions.Item(0).Item(0).Data.ExpressionVisual

expr.ColWidth = 0

chart.SetProperties p

end sub

The first index refers to the expression/column number.

Regards,

Montal.

View solution in original post

5 Replies
Not applicable
Author

Hi.

Try to use a VB macro (which will be triggered on document open or on activate sheet):

Sub example

set chart = ActiveDocument.GetSheetObject("CH01")

set p = chart.GetProperties

set expr = p.Expressions.Item(0).Item(0).Data.ExpressionVisual

expr.ColWidth = 0

chart.SetProperties p

end sub

The first index refers to the expression/column number.

Regards,

Montal.

Not applicable
Author

Montal, thanks very much that works really well (set size to 1 and it gives me a perfect dividing line) Smile

Not applicable
Author

I also hide unwanted columns in this way but would recommend you set them through a 'one-off' macro (use a button to run them) rather than on an event as running a macro obviously destroys caches etc which can affect performance.

When I upgraded to v9sr4 from v8.20 I had an issue which I went through with support and you should be aware of their comments:

Original Case Description:

I often use one-off macros to 'hide' columns by setting their column width to 0.

In v9SR4 where there is 'fast change' allowed between a pivot and straight table (chart types), it has no effect on the straight table (that is the column width is applied to the pivot table view but not the straight table)

This is the code:

sub OneOff4

' Set dummy chart dimension to 0 width (numbered from 0)

set chart = ActiveDocument.GetSheetObject("CH01")

set p = chart.GetProperties

set dims = p.Dimensions

dims(11).ColWidth = 0

chart.SetProperties p

end sub

After being run as an action to a button (when in the windows client), the 12th column of the chart has 'disappeared' in pivot table view but on clicking 'fast change' the straight table still shows the column. This worked as expected under v8.20.

Is this a bug?

Response



There has indeed been a change in 9 on how column resizing works.

If you want to hide a column in a straight table, you should not use the column width function, it will not accept a value lower than 10. Instead use the Hide function or use conditional show of columns.

For Pivot tables, it's another story. Officially, QlikView does not support hiding columns in a pivot table, since it can break the calculation matrix. However, as you have noticed, your old method of setting table width to 0 does still work for pivot tables. The column will not be visible, but it will still be calculated. I do not know if this functionality will be retained in future versions though.

You could try to apply both a "hide" and a "column width change" in your macro so both tables in your fast change get affected. What I recommend however is that you reexamine how you want to display your data, maybe using multiple tables or conditional shows.

Regards,

Gordon



Not applicable
Author

Thanks Gordon that is interesting.

I'm using QV 9 sr 6 and the method suggested by Montal is working OK for me in a straight table and in a pivot table with no problems at all; even with fast switching?

Perhaps they've made alterations to how it works in the sr6 version?

Not a big VBScript person but I do notice that your code is a bit different to Montal's, coul this be the difference in result?

Best regards

Dominic

Not applicable
Author

Montal's code refers to expressions whereas mine relates to dimensions. I would think the same is true for both dimension and expression columns though.

Its interesting to see that sr6 is different to sr4 regards this.

Regards,

Gordon