Vincent Verhoef Posted May 9, 2023 Posted May 9, 2023 Hi all,I am trying to hide certain calculated column. I found the following solution on this forum:# Import Modulesfrom Spotfire.Dxp.Application.Visuals import *# Set row header column width to 0 (i.e. first column)vis.As[CrossTablePlot]().RowHeaderWidths.Item[0]=0However, 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.
Mihai Daniel OLTEANU Posted May 10, 2023 Posted May 10, 2023 Hello Vincent,I would have a workaround for this. You can use a Property control / list box multiple select and a document property to add on user choice the columns.If you are ok with this I can give you all details.
Vincent Verhoef Posted May 11, 2023 Author Posted May 11, 2023 Hi Mihai,Thanks for your reply! I would be very much interested in this solution, please share me the details.Thank you in advance !
Mihai Daniel OLTEANU Posted May 11, 2023 Posted May 11, 2023 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:In the text area, I added a Property Control, type List Box (multiple select.).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.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.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
Vincent Verhoef Posted May 12, 2023 Author Posted May 12, 2023 This works surprisingly well, thanks Mihai!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now