r2d2
r2d2

Reputation: 195

In Spotfire, how to trellis a SummaryTable using IronPython script

I am trying to "trellis" a summary table using a script. The TrellisVisualization is not available for the SummaryTable class. Using the GUI, I can trellis a summary table by assigning a specific column to the Categorization property under Columns Properties. However, while using the IronPython script, I don't see any property named Categorization for the SummaryTable object. So, I tried assigning the column to the CategoryAxis as follows:

    mySummaryTable.CategoryAxis = "<[myColumn]>"

But this throws an error:

    AttributeError: 'SummaryTable' object has no attribute 'CategoryAxis'

I also tried using Axis or CategoricalAxisBase etc. as properties, but these options did not work out. If anyone has more ideas on this, please let me know. Thanks. RD

Upvotes: 2

Views: 1138

Answers (1)

clesiemo3
clesiemo3

Reputation: 1129

The key issue here is that the CategoryAxis property underneath the Summary Table class is a GET of this visual's object of the GroupByAxis class. You can see this by using the print command and getting information about the object:

print mySummaryTable.CategoryAxis

results in my Spotfire example:
<Spotfire.Dxp.Application.Visuals.GroupByAxis object at 0x000000000000002C [Spotfire.Dxp.Application.Visuals.GroupByAxis]>

You were actually quite close though. In order to set the CategoryAxis you need to set the Expression property of the CategoryAxis like so:

from Spotfire.Dxp.Application.Visuals import SummaryTable

mySummaryTable = myVisual.As[SummaryTable]()
mySummaryTable.CategoryAxis.Expression = "<[COLUMN]>"

If you need to pass an actual column name into that rather than hardcoded, I would concatenate the expression syntax and set the Expression equal to that variable:

myColumnExp = "<[" + myColumnName + "]>"
mySummaryTable.CategoryAxis.Expression = myColumnExp

Please let me know if you need any clarity regarding this. My Spotfire version for this answer is v6.5.2.26 and my API information from https://docs.tibco.com/pub/doc_remote/spotfire/6.5.0/api/Index.aspx

Upvotes: 2

Related Questions