Select method of DataTable is not working

Hi all,

I have a data table ExtractDataTable with coloumn names : Type, Status and DetailsUrl.

I want to filter the rows with Type=WI5 and Status=Open.

But when I am using the Assign activity, ExtractDataTable.Select(“Status=‘Open’ AND Type=‘WI5’”) and assigning to variable of Array of DataRow , It is not working and the filtered array of DataRow is empty.

Is there anything missing in the value of Assign activity
Could you please help me.

@maria.josephina You are missing Type=W15 in select statement, So u will will get all rows which have status as ‘Open’ regardless of the type.

Sorry That was mistake on typing the select statement.
What ever the condition is, Iam getting empty Array of data rows as the result.

Try this

ExtractDataTable.Select("[Status]=‘Open’ and [Type]=‘WI5’ ")

It is giving an exception : "Cannot find Column [‘Open’].

Is status is present in your excel as column ?

yes. status is present

@maria.josephina Can u share screenshot of assign activity with select statement which u have used in ur workflow?

Hi

Can u attach the screenshot of the assign activity.

Can you please verify that you are getting some rows in Extracted Data Table. Try to print the Dt.Rows.Count.ToString, if yes do this

image

WIList is an Array of DataRow[]

If this even does not work attach a screenshot what you actually are doing

Thanks,
Prankur

ExtractDataTable.Select(“convert([Status], ‘System.String’) = ‘Open’ and convert([Type], ‘System.String’)=‘WI5’”);

@ maria.josephina I have faced same issue : you are not getting results because of I just check is that I(Capital ai(I) or l(lower case of l)) check the equal symbol with both of these values.

1 Like

In Excel Read Range activity, check Add headers as true.

1 Like

The solution that fixed this for me was to make sure to not use copy paste! My " " and ’ ’ characters were not being recognized by Studio.

Use the following code, but type in manually.

extractedWorkItems.Select(“Type=‘WI5’ AND Status=‘Open’”)

2 Likes

Hi @Michael_Taylor1

If you place your code between ` sings, it will display properly and will even copy-paste properly. Try it yourself :smiley:

extractedWorkItems.Select(“Type=‘WI5’ AND Status=‘Open’”)
and after I manually corrected it:
extractedWorkItems.Select("Type='WI5' AND Status='Open'")

For longer blocks of code you can use it like this:

extractedWorkItems.Select("Type='WI5' AND Status='Open'")

The syntax looks like this then:

```
extractedWorkItems.Select(“Type=‘WI5’ AND Status=‘Open’”)
```

1 Like

Hi,

I am having the same problem. I tried all the options mentioned above still not working.

PFA the screenshot as well of select statement.

Hi @raghavbidani
what is your error, is it the column doesn’t exist error?

I suggest that you try with only one condition first. Like “Status=‘Open’”
Check to see if it finds all the Open items. If that part works, then put Type back in. Also, make sure you don’t mix up “eye” and “ell” because they look the same. Also also, this Select format doesn’t consider that the cell values could have end spaces, so I would check the Excel file to make sure the values are exactly equal to the type you are looking for.

Hope that helps.

Regards.