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

Fetching specific cell from datatable using ironpython


Baljeet Dhaliwal 2

Recommended Posts

Hello Baljeet,

You can use the DataTable.Select() to limit the selection and the retrieve the required value.

Can you try the following script

from Spotfire.Dxp.Data import *

from System.Collections.Generic import List

 

table=Document.ActiveDataTableReference

# select an expression to limit the data in a table

rowSelection=table.Select('Period = "2017-2"')

 

# Create a cursor to the Column we wish to get the values from

cursor = DataValueCursor.CreateFormatted(table.Columns["Sales"])

 

# Create List object that will hold values

listofValues=List[str]()

 

# Loop through all rows, retrieve value for specific column,

# and add value into list

for row in table.GetRows(rowSelection.AsIndexSet(),cursor):

rowIndex = row.Index

value1 = cursor.CurrentValue

listofValues.Add(value1)

 

 

for val in listofValues:

print val

Link to comment
Share on other sites

  • 1 year later...

Hi Team,

 

I have a similar query. 

 

I have a data table. I am taking an input from user from text input field and need to search a column for value to be found or not. if value found, then I want the whole row from the table to be returned.

 

Can you suggest a psudo code for the same. For security reasons, I can't share my progress. But I am new to ironpython and spotfire. I developed the code in regular python (spyder) first and now trying to fit that in ironpython. Please suggest.

 

Thanks in anticipation,

 

Rohit

Link to comment
Share on other sites

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...