This sample python script demonstrates how to combine multiple row selections(filtering/marking/limit data by expression) to read only the visible data (skipping the filtered out rows)
Introduction
This sample python script demonstrates how to combine multiple row selections(filtering/marking/limit data by expression) to read only the visible data (skipping the filtered out rows)
Code Sample
# Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license. from Spotfire.Dxp.Data import DataValueCursor from Spotfire.Dxp.Application.Visuals import TablePlot, VisualTypeIdentifiers from Spotfire.Dxp.Data import RowSelection, DataSelectionOperation from Spotfire.Dxp.Data import IndexSet visual = None for vis in Document.ActivePageReference.Visuals: if vis.TypeId == VisualTypeIdentifiers.Table: visual = vis.As[TablePlot]() table = Document.Data.Tables['Cars'] rowCount = table.RowCount rs = RowSelection(IndexSet(rowCount, False)) #Get rows via limit data by expression limit1 = visual.Data.WhereClauseExpression= "[Division]='Audi'" rowSelection1 = table.Select(limit1) #Get rows via Marked selections rowSelection2= Document.ActiveMarkingSelectionReference.GetSelection(Document.ActiveDataTableReference) #Intersect both rowselections to get only the rows that will intersect rows = RowSelection.Combine(rowSelection1,rowSelection2,DataSelectionOperation.Intersect).AsIndexSet() cursor = DataValueCursor.Create(table.Columns["Mfr Name"]) for row in table.GetRows(rows, cursor): print cursor.CurrentValue
References
License: TIBCO BSD-Style License
Recommended Comments
There are no comments to display.