1

Background Story

I have an excel table of values with thousands seperator . and floating point seperator ,. If the number is lower than 1000, therefore only the , exists. In UiPath, I'm using a read range and store the data in a data table. Somehow, Uipath manages to replace the , by a . because it interprets the value as float. But this only happens to values lower than 1000. Larger numbers are interpreted as string and all the seperators stay the same.

Example:

+───────────+───────────────+─────────+
| Input     | UiPath Value  | Type    |
+───────────+───────────────+─────────+
| 4.381,14  | 4.381,14      | String  |
| 5.677,50  | 5.677,50      | String  |
| 605,27    | 605.27        | Double  |
+───────────+───────────────+─────────+

Problem

I want to loop through the data table and apply some logic to each value. Because of the different data types, I assign the value to a generic value variable. It is a huge problem that the , is automatically replaced by a ., because in my context, this is a completely different value. Therefore I somehow need to check the data type, so i can replace the seperator again.

Attempt

enter image description here

I'm trying to get the type by GetType().ToString(), but it only delivers me: UiPath.Core.GenericValue

toffler
  • 1,231
  • 10
  • 27

1 Answers1

0

I tried to replicate it. And I have successfully converted to double using the following steps. I have taken one value and followed the below steps.

strValue = dt(0)(0).ToString.Replace(".","$") 
strValue = strValue.Replace(",",".") 
strValue = strValue.Replace("$",",") 
dblValue = CDbl(strValue)

In UiPath, when we read data from Excel, it will be treating the cell values as generic objects. So, we explicitly convert it to String.

K.Krishnakanth
  • 127
  • 1
  • 15