Last active
August 29, 2015 14:01
-
-
Save iamgabeortiz/1d33b8b12e49aea85fab to your computer and use it in GitHub Desktop.
Set a Property from a Marked Elements Underlying Column Data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ------------------------------------------------------------------------------- | |
## 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A lot of help on this one from TibCommunity.