How do I clear a DataTable in a Workflow?
I've created a DataTable and have used it to do some work, but I need to Clear it for using again in an interative process. I see the Remove Row From DataTable activity, but I don't have an "Index" value to provide for the current row. Does anyone know a quick way to either execute a DataTable.Clear method or a way to identify the "zero-based Index" of the current row so I can loop through them and use the Remove Row activity?
0
-
I believe you can do this with the 'Invoke Method' workflow activity. Set the targetObject to your datatable and set the methodName to 'Clear' (case sensitive). 0 -
Thanks! The old InvokeMethod. So that's what that's for. Is there a way to get the current zero-based index for a DataRow? I need that for another issue I'm wrangling with. 0 -
Again untested, but I think you could do something like yourDatatable.Rows.IndexOf(theDataRowYouAreLookingFor) which returns an integer.
Most of the time I am looping through the datatable or array of found datarows so I just throw an incrementer in the loop to get the index I'm looking for.0 -
Of course, an incremented counter. DOH!
Thanks again for the quick response.0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
4 kommentarer