Jump to content

Script to Sort Cross Table visualization by Grand Total Column


Tiffany Williamson

Recommended Posts

I've searched the forum and couldn't find a way for this to work, sorry if it's a repeat!

I'm trying to script a few buttons to change the sort on a cross table for the end users. Alphabeticaland Grand total ascending/descending. The alphabetical was easy enough to simply remove the default sort. However, for the Grand total I've used a couple different versions and am not having much luck.

 

This one (which seems to be the go-to) just removes any existing sort

from Spotfire.Dxp.Application.Visuals import CrossTablePlot

from Spotfire.Dxp.Data import SortOrder

from Spotfire.Dxp.Application.Visuals import CategoryKey

ctable=cTable.As[CrossTablePlot]()

ctable.SortRowsCategory = CategoryKey('Grand Total')

ctable.SortRowsOrder=SortOrder.Ascending

ctable.SortRowsMode=CrossTablePlot.SortMode.Global

 

This one works, but only if the Grand total column is already sorted.

from Spotfire.Dxp.Application.Visuals import *

from Spotfire.Dxp.Data import *

ctable=cTable.As[CrossTablePlot]()

ctable.SortRowsOrder=SortOrder.Ascending

ctable.SortRowsMode=CrossTablePlot.SortMode.Global

 

Some more info on the data. Horizontal access is creation date (year) and vertical is project names. Values are # of projects.

 

Thanks in Advance!

Link to comment
Share on other sites

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...