Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Presentation value by macro

Hi

I am allowing the user to switch the group in the chart to see data with different sort orders.

I found the very handy short macro to remove the existing group and add a new one.

Sub SetDimension()
vSheet = ActiveDocument.Variables( "vSheet" ).GetContent.String
vGroup = ActiveDocument.Variables( "vGroup" ).GetContent.String
set c = ActiveDocument.GetSheetObject(vSheet)
c.RemoveDimension(0)
c.AddDimension(vGroup)
End Sub

As my chart has possibly lots of dimension values I need to limit the shown bars using the Presentation / Dimension Limitation settings in the properties dialog.

By replacing the dimension I lose this setting. I have scanned the documents but can not really figure out where these settings are represented in the object tree.

Thanks

6 Replies
Not applicable
Author

Hi Juergm,

In theory, this must work, but, I think there is a bug, see my attached file, there is a code founded on API guide but it doesn't work.

Best regards.

Not applicable
Author

Hi

lacking any response to my first post I have investigated further and found that I can get the values for the "ChartProperties.Presentation.Dimensions limitations" using

set c = ActiveDocument.GetSheetObject(<my sheet>)
set p = c.GetProperties
msgbox(p.ChartProperties.MaxNumbersShownInChart)
msgbox(p.ChartProperties.XAxisScroll)

but still am not able to find the representation of the checkbox for "Max Visible Number (1-100)" in the object tree.

Setting the above two values will give me an empty chart only, when checking on the properties I see that my new settings (which I store with "c.SetProperties p") get removed by qlik or are never accepted.

Background is that I want to switch the dimension to achieve different sorting orders by removing the existing and adding a new group dimension.

Anybody has a hint for that?

P.S. It would be great to get at tooltext for every field in the dialogs showing where in the object tree it is stored ...

Not applicable
Author

Hi Miguel

Thanks for your response. If I set in your example the

dims(0).MaxNumberShown = 3

the msgbox shows me 3 but the chart shows 4 columns. Also the controls are not set in the properties dialog.

I assume there is an additional flag to be set which represents the checkbox "Max Visible Number(1-100)" in the dialog

Jürg

Not applicable
Author

Hi Miguel

Finally it works with this setting

dims(0).MaxNumberShown = 1
dims(0).MaxNumShown.v = 3

It was good to get your input. This pointed me to the fact that each dimension can have a different number of "max visible" and only the first one allows to set the scroll bar.

Juerg

Not applicable
Author

Hi Juerg,

You've got it, but if just use the sentence dims(0).MaxNumShown.v = 3 it works perfectly, the key was the .v how did you find that property extension?

Best regards.

Not applicable
Author

Hi Miguel

In the APIGuide you can track it down to be an IValueExpr which has a v Member, I assume becaues it can not only be a value but the result of an expression.

Some examples show the .v syntax (search for *maxnumshown* in the example texts), others not. It might also just be the default property and does not need to be specified.

have a good time