I have been trying to do a datatype check in a decimal column of a file by using the Data Flow from Azure Data Factory, but it is not working as expected. My issue is the following one:
I want to check if the number 121012132.12 is a decimal, so I am using the data flow’s derived column and writing the expression: isDecimal(‘121012132.12’, ‘17.2’). The output has always been false, even if I change the precision or replace a dot with a comma, etc. I have tried many different ways, but without success. I realized that if I shorten the number, it recognizes it as decimal. Moreover, If I try to convert it into decimal, it works well (toDecimal(‘121012132.12’, 17, 2)
Please, can anyone tell me if there is a different way to do this check?
Thank you in advance
2
Answers
This happens because for decimal the precision is defaulted to (10,2).
try isFloat(‘121012132.12’) this will work
Thanks
Hijesh
In azure data type check does not work as we expect
isFloat(100) = true
isFloat(100.1) -> true
isDecimal(100) -> true
isDecimal(100.1) -> true
Try below
iif(length(coalesce(split(VALUE,'.')[2],''))>1, true(), false())