Filter DataTable with incorrect DataType

activities
studio

#1

Hi,
I need to filter a datatable on values < 200. However my datatable is extracted from a web page and the values are saved as strings and not doubles. How can i change the datatypes from String to Double? I have tried using the Filter DataTable Activity but it does not work since it is not correct format. I already tried:

  1. Convert.ToDouble inside a for each row but it does not allow me to change the types.
  2. Change the DataTable Column type but this erases all the values.
  3. Using Select but not sure how to define the select criteria since “[Column]<200” will not work on string.

Please see attachement for my .xaml. You can run the entire thing and then my issues are in the end of the flow.

Thanks,

PierreData extraction.zip (540.1 KB)


#2

Try Convert.ToDouble(String)


#3

Hi did you get an answer?


#4
  1. Clone the existing datatable to newdt
  2. Change the data type of that column
  3. Using for each loop of existing datatable, add datatable row to newdt with converted values.

#5

Hi,
i used your sample code to download the data saved into excel file (for testing purpose).

and i added the code in main.xaml – >

  1. filter data table --> to remove the empty cells.
  2. Linq --> to get the values which are < 200
    Data extraction (2).zip (549.9 KB)