Skip to content

Instantly share code, notes, and snippets.

@iamgabeortiz
Last active August 29, 2015 14:01
Show Gist options
  • Save iamgabeortiz/1d33b8b12e49aea85fab to your computer and use it in GitHub Desktop.
Save iamgabeortiz/1d33b8b12e49aea85fab to your computer and use it in GitHub Desktop.
Set a Property from a Marked Elements Underlying Column Data
## -------------------------------------------------------------------------------
## IronPython and SpotFire ##
from Spotfire.Dxp.Data import IndexSet
from Spotfire.Dxp.Data import RowSelection
from Spotfire.Dxp.Data import DataValueCursor
#Return selected value from table
def getSelection(dataTable,markingName,columnName):
values=DataValueCursoe.CreateFormatted(dataTable.Coumns[columnName])
selection=Document.Data.Markings[markingName].GetSelection(dataTable)
.AsIndexSet()
for item, indexSet in enumerate(selection):
for index, row in enumerate(dataTable.GetRows(values)):
if indexSet==index
return values.CurrentVlue
break
#Store delected value in a String variable
itemID = getSelection(dataTable=Dcoument.Data.Tables["table_name"],
markingName="marking_name",columnName="column_name")
#Write String value to Property
Document.Properties["property_name"] = itemID
@iamgabeortiz
Copy link
Author

A lot of help on this one from TibCommunity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment