Need help to define LinQ query

I have excel sheet I have converted it to DT and Stored in Report.DT Now I have to Filter Status collumn as passed and modules Name collumn as Customer .

This is the query Filtered_DT.Select(“[Status]=‘Passed’ And [Modules Name]=‘Customer’”) I used but it is not working it is throwing an error of “Multiple Assign-Modules count: Can not assign 'Filtered_DT.Select(”[Status]=‘Passed’ And [Modules Name]=‘Customer’“)’ to ‘Customer_Pass_count’.”

Can anyone help me to get solution of it.

Hi @Logesh_Ekeshwara_Rao

Try this linq query or simply you can use Filter DataTable activity

DT = DT.Select("[Status]='Passed' And [Modules Name]='Customer'").CopyToDataTable()

Input:

image

Output:

image

Or

If you want Customer_Pass_count then try below

Customer_Pass_count = DT.Select("[Status]='Passed' And [Modules Name]='Customer'").Count

Cheers!!

U have to use where statement to filter out. Filter_DT.Select(where …). copytodatatable()

@Logesh_Ekeshwara_Rao,

It’s the issue of DataTypes you are trying to assign this.

If you are trying to get matched data into a DataTable:

datatableVariable = Filtered_DT.Select(“[Status]=‘Passed’ And [Modules Name]=‘Customer’”).CopyToDataTable()

If you are trying to get number of rows filtered in Int32 data type:

int32Variable = Filtered_DT.Select(“[Status]=‘Passed’ And [Modules Name]=‘Customer’”).CopyToDataTable().RowCount

Thanks,
Ashok :slight_smile:

Question
When u use copytodatatable() the rows are being counted and stored as a property in Rows.Count
So using method RowCount u count the rows again instead of accessing the property?

@kali,

Nope both are same.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.