Qing Zhu Posted January 27, 2017 Share Posted January 27, 2017 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 More sharing options...
Niraj Kesarwani Posted August 30, 2017 Share Posted August 30, 2017 I am alos facing same issue . anyone can help Link to comment Share on other sites More sharing options...
Christof Pflumm Posted February 6, 2019 Share Posted February 6, 2019 Create a list containing the cursors, e.g. cursorList = list() cursorList.append(CursorA) curosrList.append(CursorB) You can then use the python * operator: for row in dt.GetRows(*cursorList): ... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now