#dataTable is a DataTable script parameter.
markedRows = Document.ActiveMarkingSelectionReference.GetSelection(dataTable)
print "Selected rows:\t" + str(markedRows.IncludedRowCount) #same as str(markedRows.AsIndexSet().Count
print "Total rows:\t" + str(markedRows.TotalRowCount)
print "Hidden rows:\t" + str(markedRows.ExcludedRowCount)
#Loop through marked rows. "symbol" is a column name
for r in markedRows.AsIndexSet():
print "row # " + str(r) + " value:\t" + dataTable.Columns["symbol"].RowValues.GetFormattedValue(r)
If you want to use a specific marking from a specific (Treemap) visualization, then:
#get a reference to the vis, datatable and marking. vis is a script parameter
myTreemap = vis.As[Treemap]()
myTreemapDataTable = myTreemap.Data.DataTableReference
myTreemapMarking = myTreemap.Data.MarkingReference
for markedRow in myTreemapMarking.GetSelection(myTreemapDataTable).AsIndexSet():
myTreemapDataTable.Columns["symbol"].RowValues.GetFormattedValue(markedRow)
markedRows = Document.ActiveMarkingSelectionReference.GetSelection(dataTable)
print "Selected rows:\t" + str(markedRows.IncludedRowCount) #same as str(markedRows.AsIndexSet().Count
print "Total rows:\t" + str(markedRows.TotalRowCount)
print "Hidden rows:\t" + str(markedRows.ExcludedRowCount)
#Loop through marked rows. "symbol" is a column name
for r in markedRows.AsIndexSet():
print "row # " + str(r) + " value:\t" + dataTable.Columns["symbol"].RowValues.GetFormattedValue(r)
If you want to use a specific marking from a specific (Treemap) visualization, then:
#get a reference to the vis, datatable and marking. vis is a script parameter
myTreemap = vis.As[Treemap]()
myTreemapDataTable = myTreemap.Data.DataTableReference
myTreemapMarking = myTreemap.Data.MarkingReference
for markedRow in myTreemapMarking.GetSelection(myTreemapDataTable).AsIndexSet():
myTreemapDataTable.Columns["symbol"].RowValues.GetFormattedValue(markedRow)
No comments:
Post a Comment