How to use not equal operator with DataTable with If condition

I need to use “Not Equal” condition with two datatables. Equal is working fine for me but how to use not equal to. <> operator is not at all working. Kindly helpCapture

1 Like

You can type inside the IF:

“NOT (your condition)”

Regards

1 Like

Hi Axel, Could you please help with my condition, which shows in snap.

You want to compare data in those datatable?

Yup, EQUAL TO is working fine for me but I want to use NOT EQUAL.

1 Like

Fine
hope these steps could help you resolve this
–First we need to conver the datatable to string
–for that use a output datatable activity where pass the first datatable as input and get the output with a variable of type string named outstr1
–and use another output datatabe activity where pass the second datatabe and get the output as outstr2
–now use a if condition like this
Not outstr1.ToString.Equals(outstr2.ToString)

the reason why you first condition of equals work is
if datatable variable is with .ToString it will give as system.data.datatable so for both it will be like
system.data.datatable = system.data.datatable

which is equal indeed but not the right way to compare buddy
so we need to convert to a string and then only compare it

hope ths would help you
Cheers @khan

@khan are you converting your datatables to string before comparing?? You can use != or use Equals Method it will return True or False

Can I use “Output Data Table” for conversion or you have some other idea, please share

1 Like

yeah you can use OutputDataTable

of course
thats what suggested one and is more feasible as well buddy

Cheers @khan

how will we print data then ?