Level 3 training Exercise 2 problem with Datatable arguments filtering and assign

Hi,

I’m going through the Level 3 training and have just added a load of invokes for the System1 app into the Init sequence.

I’m having a problem with the datatable that is returned from the GetWorkItems workflow that is invoked.

image

This has an out argument of all the workitems (unfilteredfrom the system1 app) I created a Datatable variable called dtWorkItems to take the out argument

I have also created another datatable variable called WIList which will (hopefully) hold the filtered version of the dtWorkItems datatable

The problem occurs when I try the assign

image

image

The error on the assign is

image

I don’t understand the error here WIList is a Datatable and dtWorkItems is a datatable that has been filtered which should still be a data table, right?

Here is my main in case I haven’t fully described the issue
Main.xaml (53.4 KB)

Applying Select method on a DataTable returns DataRow Array. So you have to change the variable type of WIList to DataRow.

Thanks,
Rammohan B.

1 Like

dtWorkItems.Select.("...").CopyToDataTable

1 Like

Thank you both for the help I probably want to keep it as an array of DataRows but knowing that I can copy it as a datatable is also a useful bit of knowledge. Thanks

Hi Guys,

I can assign the select to a datarow array right? because my workflow fails when I do.

I created a variable WIList an array of DataRows

When I try to assign

image

image

It faults (I was debugging and in the output pane)

image

This is within the init block of the main workflow

Main.xaml (57.4 KB)

The reason that this wasn’t working was because my datatable varriable dtworkitems was null as my Extract Structured Data activity wasn’t working because the default value of the datatable variable your Extract Structured Data activity outputs to, needs to be New System.Data.DataTable

You may forget to add the default when you create your own datatable variable (Extract Structured Data creates one for you with the correct default but I think in the walkthrough it suggests you create your own and it’s easy to forget the default value, why do we need to put a default in, I don’t know!)