toFloat(+879.00) signed?

Hi everyone, I have a string that I would like to convert to a float. The data comes with a sign. The toFloat () seems not to recognize the sign. Can you help me?


Thank you all

Things I’ve tried …

The problem in this case is that I cannot have negative values.

Hi @OscarLucas, you shouldn’t need to use toFloat().

Your code: replace(replace({[~]New Tag}[1,0],"+", ""), ".", ",") works fine for me if the tag ‘2’ is set to a float datatype.

I assume the replace(tagValue, ".", ",") is being used for localisation purposes (not sure if this will cause any issues :thinking:)?

Please note you will have to change the [rowId, colId] according to which element in the dataset you require.

replace(tagValue, “.”, “,”)
it seems that the float format doesn’t support the. as a thousandth separator. Providing wrong data.

On the other hand, the selection of the column has been carried out as follows. Verifying that it is correct since assigned the string format, the display is correct.

We have the problem with the + and - signs that I can’t get them to float.

This might be because of whitespace in the string (looking at the error being displayed in the quality property). Could you use trim() to make sure there is no whitespace in the string?

What is your gateway’s locale set to? toFloat should be attempting to use the ‘default’ locale provided by Java to parse the string, which should support local representations for decimal separators and the like.