I use datatable.select() return selectdatatable, Then I write selectdatatable.copytoDataTable,but

datatable
excel
activities

#1

I use datatable.select() return selectdatatable, Then I write selectdatatable.copytoDataTable,but does not work

exception: the source contains a detached dataRow that can not be copied to the Datatable.


Can we execute a query on DataTable
#2

Hey @sarah

Datatable.select will return you datarow array so to copy them into another datatable you should use ImportRow method.

You can search this on forum.

If still any problem will you face then let us know :slight_smile:

Regards…!!
Aksh


#3

Hi Sarah,

Datatable.Select() returns an array of datarows, lets assume - dtr_filteredRows. You can use dtr_filteredRows.CopyToDatatable() in the right side of assign activity and use another datatable on the left side of assign.

Hope this helps

Regards,
Amrita


#4

thanks


#5

Hi Amrita

Can you send me an example. I do not find CopyToDatable only CopyTo.
Thanks.


#6

@Pupina check this please:
CopyToDatatable.xaml (9.6 KB)

It’s because intellisense doesn’t work for it. But if you just type CopyToDatatable, it will work without error.
More info about this in the link below:


#7

Thanks Ovi!!! It works!!!

I only need to figure out how to include headers. I read range with addheaders.
I try with clone the original datatable, instead of new datatable.
Can you also help me with this?


#8

I could do it. It is a simple property. thanks.