Jump to content

Recommended Posts

Posted

Hi all,

I am trying to hide certain calculated column. I found the following solution on this forum:

# Import Modules

from Spotfire.Dxp.Application.Visuals import *

# Set row header column width to 0 (i.e. first column)

vis.As[CrossTablePlot]().RowHeaderWidths.Item[0]=0

However, this solution is only taking in account the columns that are defined on the 'vertical' axis. If there is only one vertical axis and we try to refer to the second axis using RowHeaderWidths.Item[1], the following error occurs:

ValueError: Value of argument 'index' is 1, which is out of the allowed range [0 - 0].

Which code or setup should I use to hide a certain calculated column in the cross table?

My goal is to hide / unhide certain calculated columns based on the selected document property to create a desired few for different users using the same cross table.

Thanks in advance.

Posted

Hello Vincent,

I hope you can adapt your needs to this solution.

First of all, I will describe the matter I faced and where/how I used this.

I had a cross table with 3 (expressions/calculated) main columns. In addition, I needed to add/display and hide (depending on user chice) some other 5 more columns.

There are few steps to follow:

  1. In the text area, I added a Property Control, type List Box (multiple select.).
  2. Then I assigned a new Document Property for this property control and I made all setting by .... Set property value through: Expressions and here I added those 5 additional columns. In the Display Name will be the name of the name of the fields of the list box whereas in the expression you will be the formulas.
  3. Very important step -> use in each above expressions at the end of the formulas "as [Cross Table column name]" which will be displayed in the cross table.
  4. The most important step -> add in the expression of the cross table, preferably et the end of all formulas, the Document Property, as text, so normally like ${MyDocProperty} ... so in this way your additional columns will be displayed/hide depending on the selection on List Box.

The downside of this solution is that you need/must display at least one additional column. The user, or you, could (are able) not to select any additional column but if no additional column is selected all cross table is affected and no columns (including the main 3 ones) will be displayed.

If you have any problems or additional question do not hesitate to ask.

Best regards,

Mihai

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...