Jump to content

How to create and use cursors for all columns at one time


Qing Zhu

Recommended Posts

Hi, I am trying to build a interactive dialog that updates a data table. Inspired by the post "Set value in Data Table by IronPython",

https://community.spotfire.com/questions/set-value-data-table-ironpython

 

I am using the curors to loop through the rows to updat cells.

However, I am wondering if there is away to define muptile cursors for all columns at one time and use them in GetRows() method, instead of typing them one by one. For example, we can use do

 

CursorA=DataValueCursor.CreateFormatted(dt.Columns["RunID"])

CursorB=DataValueCursor.CreateFormatted(dt.Columns["User"])

 

for row in dt.GetRows(CursorA, CursorB,):

 

to manually define cursors for each columns (A,B,...). This will be trouble some if I have a large table with lots of columns. I have tried to define multiple cursors in a for loop, however, I am having trouble to pass them to the GetRows() method. For example, after I difined CursorA, Curosr B in a for loop, if I do

 

Combo = CursorA,CursorB

for row in dt.GetRows(Combo):

 

works OK. But I cannot combine multiple cursors using a loop or a append function. Which means:

 

Combo = CursorA

Combo.append(CursorB)

 

or

 

Combo = CursorA + CursorB

 

or

 

Combo = CursorA + , + CursorB

 

do not work with the GetRows() method. Is there a way to combine multiple cursors together that can be realized in a loop

Link to comment
Share on other sites

  • 7 months later...
  • 1 year 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...