Selecting Columns with No Column Name in DataTable

Hi Guys,

I am trying to get the CIMS_Distinct_Count ( encircled in blue ) by selecting the columns Batch_Date and OPCO_NAME (Highlighted in Yellow) .

I tried reading the range of this excel file into a datatable (dtUC4Report) and tried to filter it (dtUC4ReportFiltered) like this.

Assign dtUC4ReportFiltered = dtUC4Report.Select(“Convert([Column3], ‘System.String’) like '%”+ in_strBatchDateTime + “%’ and [Column7] = '”+ in_strOpcoName +"’").CopyToDataTable

But it won’t work as I am having error Assign: The source contains no DataRows.
Can someone help me see what might be the mistake I am making and what causes the error?
Please bear with me as I am stuck in this scenario for a while now.

Thanks a lot in advance. :slight_smile:

@junie_ann I guess you need to give the Range as “A15” in Read Range Activity. But Use this only if you don’t need the Data Above it :sweat_smile:

When you give A15 as the Range and Check Add Headers in Read Range, then You can access the Values of Distinct Count as it becomes a Column Header.

1 Like

@junie_ann
welcome to the forum

in such cases debugging along with setting breakpoint helps to find out the issue. Once you have paused the execution you can check the content of the datatable and the values of the two variables. Maybe here you will find any issues.

As an alternate to the select statement you can use following stategies for issue isolation:

  • filter only with 1 criteria (but do it for two) and check if the filter is applied correctly
  • test it with filter datatable activity and use for the date check a contains

Often the dateformat differs from Excel once it is readin into a datatable, maybe you are facing the same issue.

Let us know your feedback

2 Likes