Przemek Stasica Posted February 13, 2022 Posted February 13, 2022 Hi, Is there a way to tell Spotfireto marshall a data table column into an R variable (vector) in a way that follows the sort order from a visualisation rather than the underlying data table I'd like to choose the sorting in the visualisation and do some math later on via a data functionin a way that is aware of the chosen sorting. (the math is to apply a special custom ID that takes into account sorting in the visulisation) many thanks! Data Table (order defined by links) rank name other_name 1 name1 other_name5 2 name2 other_name1 3 name3 other_name3 Visualisation X (sorted by other_name) name2 other_name1 name3 other_name3 name1 other_name5 Data Function takes rank (as isin data table) takes other_name (sorted as in visualisation X) -- is it possible
Gaia Paolini Posted February 14, 2022 Posted February 14, 2022 You could use an Iron Python script to get the sort order of any column in your visualization. Then within the same script invoke the data function. The script could do something like this: where vis is your visualization (to be defined as input paramer). In this case it does it for a table plot. The SortMode can be Ascending or Descending. Columns with no applied sort mode will not appear in the SortInfo. from Spotfire.Dxp.Application.Visuals import * from Spotfire.Dxp.Application.Visuals import TablePlot, TablePlotColumnSortMode tablePlot = vis.As[TablePlot]() for si in tablePlot.SortInfos: print (si.DataColumn) print (si.SortMode) Then you could pass this info as a parameter to the data function, which would sort the related column(s) accordingly. Invoking the data function via a script: https://community.spotfire.com/wiki/how-invoke-pre-defined-data-function-ti... https://community.spotfire.com/wiki/how-pass-value-input-parameter-data-fun...
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