Getting error when adding two conditions


steps and excel saved in dt status is a datarow type when i add single condition where“name = ‘tom’”) this works but when i add second condition its showing error i want check for both condition and get all rows as per that

Hello @manoj2500

Can you please share the full expression that you are using and the error that you are getting?


dt.Select(“name = 'tom '” ) And dt.Select(“call = ’ 2’” )


Hi @manoj2500 ,
Can you try below expression instead

(from row in dt where row(“name”).tostring=“tom” and row(“call”).tostring=“2” select row).copytodatatable

1 Like

OutDatatable = dt.Select(“name = ‘tom’ AND call = ‘2’”).CopyToDataTable

OutDatatable is a datatable variable

dt is the input variable(Datatable variable)

Hi @Rahul_Unnikrishnan,

I have one doubt. Im getting exception if Name with apostrophe symbol(').

Without apostrophe symbol(') then fine


Are all the names having this apostrophe? Here this symbol is making the expression invalid.

else maybe you can try to split the name and join using + symbol. but it will not be the corerct approach.

Hi @Rahul_Unnikrishnan,

No only a few values
getting same error split join not working and thank you for your try :slight_smile:


Instead of spliting it inside the Select method, you need to it outside and pass that value as a variable to the select method. I think that should work.


bad luck it not work any way thank you for your efforts


Hi @RajKumar_DC,

Can you try below expression instead

(from row in dt where row(“Col1”).tostring=“Ma Do’na” and row(“col2”).tostring=“yourfilter2” select row).copytodatatable

Hi @keerthi3595,

Thank you for your Knowledge, this is working fine but i trying via filter method not Iterate method if any possible about select method.


Hi @RajKumar_DC ,

Just double the quotes that comes in between the filter“Col1=‘Man Do’‘na’”)

if you want to add it dynamic“Col1=”+str_youfilter.replace(“'”,“‘’”)+“'”)

@RajKumar_DC @Rahul_Unnikrishnan @keerthi3595
by using datatable it will throw error if there is no datarow that is why i was using datarow how to deal with that error

Please use the below in condition

(from row in dt where row(“name”).tostring=“tom” and row(“call”).tostring=“2” select row).count>0
or“Col1=‘Man Do’‘na’”).count>0

Hi @manoj2500 ,

Maybe a more clearer info on the error received would help us to understand what logic needs to be handled. For a Quick help, Check if the below post will be able to resolve your error :

Why don’t you just use Filter Datatable activity? It’s what it’s for.

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