Convert a string column to double

Hi, I have a data table and now i want to convert a particular row to datatype “Double”.
When i read the datatable it automatically reads as String type but i want to convert the row as double type.

This is the row that i want to convert … i tried Convert.double(row(“Last_Records”).tostring) but it shows error: input string was not in a correct format.

Sample file Book3.xlsx (8.5 KB)

Please help

@padmapadh1895 Why you want to convert date to double?

Can you provide your expected output? What you want

1 Like

Once i read the excel file after performing a select sql query the format of the date changes like below:
i just want to filter out Initial records = Today OR Last rcords >= Yesterday and <= Today
but there is datatype mismatch says like string to double is not valid

Can you tell me how you are filtering the data…?

You can try using filter data table activity…

If it’s not working let me know…we can do in other way also…

1 Like

i tried filter data table but since the date contains time too i could not use this activity

You can use it. But if u want to see record for today it has to be:

Initial records >= Today and Initial records < Today.addDays(1) OR Last rcords >= Today.AddDays(-1) and Last rcords < Today.addDays(1)

It will give you logic (for 21.03.2021):

Initial records >= 21-03-2021 00:00:00 and Initial records < 22-03-2021 00:00:00 OR Last rcords >= 20-03-2021 00:00:00 and Last rcords < 22-03-2021 00:00:00

1 Like

hi @Yameso , Thanks for the suggestion i tried it but its not returning anything.

Testing.xlsx (10.3 KB) Filter Dt.xaml (9.5 KB)

It is not returning anythig because there is no data for today! :smiley:

I added those values to .xlsx:


And with the same workflow as you did i got:


1 Like

If you want you can also use assign instead Filter Data Table:

out_Dt = (From i In In_dt.Select() Where _
    DateTime.ParseExact(i("Initial records").toString,"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture) >= Today _
    And DateTime.ParseExact(i("Initial records").toString,"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture) < Today.AddDays(1) _
    Or DateTime.ParseExact(i("Last records").toString,"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture) >= Today.AddDays(-1) _
    And DateTime.ParseExact(i("Last records").toString,"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture) < Today.AddDays(1) Select i).toArray.CopyToDataTable()

it will check your Dates. But if there is no results it will throw error (it can be advantage too…)

1 Like

@Yameso … Sorry i didnt notice that… Thanks so much.

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