Error in converting from string to double

Hello Folks,

I am using current expression DateTime.Now.ToString(“dd”) - 3 = CDate(item).ToString(“dd”)
But, It was showing an error strict implicit conversion from string to double. Could anyone suggest on the same. Thanks in advance

hi @ushu

What is there in item

Thanks
Ashwin S

Thanks for your response. We do have creation date values present in the excel as you can see in the screenshot. From that i am trying to retrieve only date i.e; 08.

@ushu Follow below steps

assign v1=row(10).ToString
assign v1=CDate(v1).ToString(“dd”)

Actually, here the requirement is need to retrieve the date from the excel and compare it with the todays date. if the resultant date is greater than 48 hrs ago then we need to update the count in the o/p excel file.

1 Like

try this @ushu

excelDate CDate(excelValue).tostring(“dd”) - Now.Date.ToString(“dd”) > 2 (which is 48 hours) then do the remaining steps

Thanks for your response. Will try on it

I tried it by taking assign activity with the variable type as string. But, it was showing the same error. So, I tried by making the variable type as double. Still the same issue. Please suggest

Here we are checking the condition @ushu. It is a boolean output :slight_smile:

Thats why I asked you to give it in IF condition or if you want to assign. then assign it to boolean type variable

Fine
Hope these steps would help you resolve this
—use excel application scope and pass the file path as input
—inside the scope use the read range activity and get the output with a variable of type datatable named outdt
—use a for each row loop and pass the above variable as input and inside the loop use a if condition like this
Convert.ToDouble(row(“Creation Date”).ToString.Trim.Substring(0,2)) - Convert.ToDouble(Now.Tostring(“dd”)) > Convert.ToDouble(“02”)

This expression will compare the date from excel with today’s date and if the resultant is more than 2 that is 48 hours, we can use the assign to increase the count in the THEN part of if condition or if it’s false it will go to ELSE part where we can leave it empty

Hope this would help you
Cheers @ushu

1 Like

Thanks for your responses. I tried with these solutions. But, still facing the same issue. Attached my actual workflow. Could anyone check and suggest me on the same

Compare Date.zip (9.2 KB)