Hi Please help me on the issue.
Please find the attached.
I am filtering some data through Datatable but getting an error like, Cannot perform ‘<>’ operation on System.Double and System.String.
Help if anyone knows !
Thanks in advance
Hi Please help me on the issue.
Please find the attached.
I am filtering some data through Datatable but getting an error like, Cannot perform ‘<>’ operation on System.Double and System.String.
Help if anyone knows !
Thanks in advance
Hi @hemal
Can you share sample data? Or workflow
Also it looks like in the same column you are using String and Int both
Thanks,
Prankur
Test.xaml (9.9 KB)
Please find the attached test file . You can create a simple excel file with the data ‘S1’ or ‘60’
thanks,
hemal.
Should I consider this as sample data?
I think this should work
dtop.Select("Subinventory='60' and Subinventory <> 'S1'").CopyToDataTable()
Thanks,
Prankur
This works for me
dtop.Select("Subinventory='60' and Subinventory <> 'S1'").CopyToDataTable()
Also, I don’t understand the condition because you are filtering on the same column so there is no need to add not equals to condition You can filter that by the first one only which will give you records that have SubInventory as 60
Thanks,
Prankur
Hi Prankur,
It was just testing purpose. So I added both the conditions. Ignore it. But the thing is, I am getting an issue. Even if i write only Subinventory <> ‘S1’ .
Thanks for your help.
I don’t understand what is wrong with my code !
Hi Prankur,
Please find the attached screenshot. I am getting this since yesterday! What’s wrong with it! Please help
Thanks,
Hemal
1-31-2019.xlsx (7.8 KB)
Hi Prankur,
Please find the attached excel file and do it with read range activity
Thanks.
Remove the whole activity for filter and write it again. Also please make sure that quotes are correct, copy it from here
dtop.Select("Subinventory='60'").CopyToDataTable()
Thanks,
Prankur
Thanks @prankur but still i’m facing. I have cleared and copied your code still i’m getting the same error.
Can you please check with the excel file once.
Thanks,
Hemal
I think, I am getting it. What I feel is, that Subinventory column data type should be changed in excel file.
Check this property in Read Range
If this not works along with this format excel column as Text, its working for me
Also in message box it should be
item(1).ToString
Because index starts from 0
Thanks,
Prankur
Try filter data table activity to get the results for both equal and Not equal parameters.
Hey @PrankurJoshi,
Thank you so much that property (PreserveFormat) was unchecked so i just checked and it is working fine !
Thank You so much
Hello @hemal
Just to explain what is happening…
you are getting this error because you are building datatable with external data i.e. an excel file. When UiPath read an excel file and build datatable… all the columns are assigned with datatype of ‘object’ (because UiPath does not know which column contains what type of data). Also every row item i.e cell will carry the datatype according to the value held by them (unless PreserveFormat in ReadRange>PreserviceFormat is checked, then they(all the row items) will have datatype of string)
to solve this issue you can use below query:
dt.select(“Convert([Col1],‘System.String’) = ‘60’ or Convert([Col1],‘System.String’) <> ‘S1’”)
or just check the PreserveFormat as suggested by @PrankurJoshi
~Akshay
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.