Jump to content
We've recently updated our Privacy Statement, available here. ×

Not able to execute iron python script on single click of button control

Prateek Rawat

Recommended Posts

I have a requirement where I have to refresh a table on demand and then use the refreshed values to calculate the rank for one of the table column.

I have used the below script for table refresh -->

if table1.IsRefreshable and table1.NeedsRefresh:


And the below script for comparing rank-->

from Spotfire.Dxp.Data import *

from Spotfire.Dxp.Application.Visuals import *

from Spotfire.Dxp.Data import DataProperty

from Spotfire.Dxp.Data import DataPropertyClass

import Spotfire.Dxp.Application.Filters as filters

import Spotfire.Dxp.Application.Filters.ListBoxFilter

import Spotfire.Dxp.Application.Filters.ItemFilter

import System.String as String

from Spotfire.Dxp.Application.Filters import FilterTypeIdentifiers

from Spotfire.Dxp.Data import DataPropertyClass

from Spotfire.Dxp.Data import DataType, DataTableSaveSettings

from System import String

from Spotfire.Dxp.Data import AddRowsSettings

from System.IO import StringReader, StreamReader, StreamWriter, MemoryStream, SeekOrigin

from Spotfire.Dxp.Data.Import import TextFileDataSource, TextDataReaderSettings

from Spotfire.Dxp.Data import DataType, DataTableSaveSettings

from Spotfire.Dxp.Data import RowSelection, IndexSet

from System.Collections.Generic import List, Dictionary

from Spotfire.Dxp.Data import DataTable

from System.Collections import ArrayList


#get the data table


# Get a reference to the specified filtering scheme on the data table above

dataFilteringSelection = dataFilteringSelection = Document.Data.Filterings["Filtering scheme"]

filteringScheme = Document.FilteringSchemes[dataFilteringSelection]

filterCollection = filteringScheme[table]

# Filtered rows based on the scheme above

filteredRows = filterCollection.FilteredRows

#place generic data cursor on a specific column

cursorA = DataValueCursor.CreateFormatted(table.Columns["RankBedNumber"])

#list object to store retrieved values

valDataA = List [str]();

#iterate through table column rows to retrieve the values

for row in table.GetRows(filteredRows,cursorA):

#rowIndex = row.Index ##un-comment if you want to fetch the row index into some defined condition

valueA = cursorA.CurrentValue

if valueA str.Empty:


print valueA

print valDataA

a = min(valDataA)

print a

Document.Properties["RankSelection1"] = a

if table1.IsRefreshable and table1.NeedsRefresh:




I am unable to execute both steps on single click. Have to create 2 buttons to execute the same. Any inputs to get this done with one single click would be helpful.

Link to comment
Share on other sites

  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...