Convert datacolumns from string to decimal

Hi @PD2,

Thanks to your help, I managed to figure it out! Turns out my row-iteration was wrong, after fixing that the ‘normal’ Convert.ToDecimal worked out perfectly in an assign activity.

Solution:

  1. Use a for each row activity to iterate over cell values (within the datatable)
  2. Use an assign activity to perform the following operation:
    a. row.Item(“col1”) = Convert.ToDecimal(row.Item(“Col1”))

It should look something like this:
image
*where DT is the example datatable

NB: while performing this operation on currency data, it failed on strange symbols (€), so I used @MAHESH1’s solution to keep only numerical values from a string:

string b= System.Text.RegularExpressions.Regex.Replace(“string_Variable”,“\D”,“”)

Once again, thanks for all the help!

Kind regards, Mark