I am facing a challenge in error “Assign: Exception has been thrown by the target of an invocation.”
I am trying to scrape the data using Table extraction and remove the first row of a Data Table and making the second row as column header .I am getting the Table Table as column number in first row instead of column name. I am trying to remove the first row.
I am extracting the DataTable and using a For Each Loop. Then using an assign activity
and finally deleting the first row,
@dutta.marina Run it in debug to see what the datatable & your variables contain.
currentitem is not a column. It’s just an item in a string array.
If you’re trying to rename a column you need to do…
ExtractDataTable_CreditMemo.Columns(index or column name).ColumnName
instead of currentitem.ColumnName
The same way I did for previous data table. I tried to remove first row and the second row became header or column name. There was no error .
In your For Each, did you change the TypeArgument to System.Data.DataColumn?
I’ve usually done this by using the .Columns array as an array of strings just to get the column names, then referencing the column by name on the left side of the Assign…but I guess it could work doing it the way you’re doing it as long as you have the For Each set up properly.
Please check one thing. Your number of column and number of values present in first row. I believe when it comes to last column it founds issue because of corresponding empty value.
Please run in debug mode and then you can open the locals panel and see the exception details…which will contain the exact error which has occured…accordingly we can move forward
sure Anil. Let me do that