Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Auto "Fit Columns to Data" or with a extra button

There is a possibility in Qlikview to "Fit Columns to Data" from a straight table. But this need to be done by a rightclick or trough the menu. Now i want to make my qlikview document a lot more userfriendly. And this is liek this not/les the case. Because my table has always different results and different width's for the cell's text this "Fit Columns to Data" need to be pressed a lot.

snap.jpg

Is there a way that this is automated? Trough a function from qlikview itself or a macro?

If this aint possible... can this be done by adding a button to do this?

Iv'e read a lot topics about this, but they all dont do the ting asked.

6 Replies

Re: Auto "Fit Columns to Data" or with a extra button

Hi,

     You can use the functionality available under layout Tab "Size to Data"

Regards,

Kaushik Solanki

Not applicable

Re: Auto "Fit Columns to Data" or with a extra button

This does not seem to work, at least not when it has been resized once. even when i uncheck it, save, check it and save again. mayby it need to be changed to "Always Size to Data"

Re: Auto "Fit Columns to Data" or with a extra button

It seems there is none method for doing this directly. But you could set the column width static with a fix value or by reference to any value - see for such examples APIGuide.qvw.

dim w(3)

w(1)=100

w(2)=150

w(3)=200

set chart = ActiveDocument.Sheets("Main").CreateStraightTable

chart.AddDimension "ProductType"

chart.AddExpression "sum(Amount)"

chart.AddExpression "count(Product)"

chart.SetPixWidths 0,w

chart.EqualPixWidths 1

Brute force is to read every cell-value for each column and count the char to receive the max-value and set herewith the column width (not really recommended but possible).

- Marcus

Not applicable

Re: Auto "Fit Columns to Data" or with a extra button

I have a pivot table, the script:

chart.SetPixWidths 0,w

chart.EqualPixWidths 1

doesn't work

Thanks

Re: Auto "Fit Columns to Data" or with a extra button

SetPixWidths is for straight tables and SetPixWidth without "s" for pivot tables.

- Marcus

Not applicable

Re: Auto "Fit Columns to Data" or with a extra button

Yes! It's ok!

Thank you very much Marcus

Community Browser