Assign: Cannot perform '=' operation on System.Double and System.String

I have assigned variable in Assign Activity.Value is to given as below.But it shows error.Provide solution
FileDt.Select("[Delivered Qty] =’ ’ ").CopyToDataTable

@Priyanka_Sorate, Remove square square brackets “” and it sould work. :slight_smile:

1 Like

FileDt.Select("Delivered Qty =’ ’ ").CopyToDataTable

2 Likes

Hi @Priyanka_Sorate try this dt.Select("[Delivered Qty]=’"+" " +"’ ").CopyToDataTable

@Priyanka_Sorate I think it’s better to use Filter Datatable Activity for this in this way :sweat_smile:

Also If you want to use Linq and Get the Output You can use a Different Linq in this way :
FileDT.AsEnumerable.Where(Function(x)String.IsNullOrEmpty(x(“Delivered Qty”).ToString) Or String.IsNullOrWhiteSpace(x(“Delivered Qty”).ToString)).CopyToDataTable

I think the Original Linq that you have used doesn’t seem to Get Output because the Data that are you comparing are of Incompatible Types (Comparing Double with a String ). If you get the Solution Similar to the Original Linq, Please Post it here. :sweat_smile:

ok thanku but it is not work out i will try next

I used this one but using Isempty data not displaying in same sheet.Thank you

@Priyanka_Sorate What you mean by same Sheet :sweat_smile:

Hi
Did we try with this expression
Yourdatatable = FileDt.Asenumerable().Where(Function(a) a.Field(of String)(“yourcolumnname”).ToString.Equals(“ “)).CopyToDatatable()

Cheers @Priyanka_Sorate

1 Like

@Priyanka_Sorate, It seems like data type of “Delivered Qty” column is double. If it’s a nullable column and if you want to retrieve all rows where “Develiered Qty” is null then you can use the following value.

e.g. FileDt.Select("[Delivered Qty] IS NULL")

Hi @Priyanka_Sorate did u try this method??

i tried this one also it shows error i will working on that
Assign: Syntax error: Missing operand after ‘’’ operator.

1 Like

Hi @Priyanka_Sorate it worked for me.In datatable i got the row with Delivered Qty which was empty… :sweat_smile:

Ok thanku

1 Like

ok hope so slightly_smiling_face: this will be worked for me also :slightly_smiling_face:

Hi @Priyanka_Sorate Yes i got ur error use for each row and convert ur column Delivered Qty to string and then try this dt.Select("[Delivered Qty]=’"+" " +"’ ").CopyToDataTable

This is an old post but became my problem, so posting what worked for me here for others’ benefit.

You seem to be hoping to collect all rows where the value in [Delivered Qty] is BLANK? For that you’ll want to remove the equals sign and single quotes; and replace with is null.
FileDt.Select(“[Delivered Qty] is null”).CopyToDataTable

If you were supplying your Select statement with a date (may work with numbers too, maybe?), that solution is hidden in Mateus’ answer (https://forum.uipath.com/t/filter-datatable-contains-datetime/55867/3:
those values need hashtags added around the value in order to properly read in as a double instead of string.
(in an Assign activity): ArchiveDate = DateTime.Now.AddDays(-14).ToShortDateString // This is whatever date was two weeks ago from today, and the Select syntax looks like:

FileDt.Select(“[Delivery Date] >= #”+ArchiveDate+“#”).CopyToDataTable

Excuse me, I’m afraid this fails when dealing with DateTimes that have spaces in them, like most do that include the time of day (e.g. “MM/dd/yyyy hh:mm:ss”). Including the single quotes outside of the hashtags fixes the problem:

FileDt.Select("[Delivery Date] >= ’ #"+ArchiveDate+"# ’ ").CopyToDataTable