Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
HOkoro1605033487
Contributor
Contributor

How can I check for  a decimal number in talend

How can I check for a decimal number with up to 12 places before decimal and precision of up to 3 places after the decimal. without the currency symbol and without comma separators

Labels (4)
3 Replies
Anonymous
Not applicable

Hello,

Could you please elaborate your case with an example with input and expected output result?

Best regards

Sabrina

HOkoro1605033487
Contributor
Contributor
Author

I am trying write a variable that verify my input data is three digit decimal like this 123456789012.121within tmap, if it is not three digit then I will write out an error code. ? 1 : 0

 

Thanks

 

Hank

madhukolli2003
Contributor III
Contributor III

Hi @Hank Okoro​ ,

Please use below formula in tmap expression

 

StringHandling.LEN(row1.value) - (StringHandling.INSTR(row1.value,".",1,1))  to calculate length after decimal point

StringHandling.LEN(row1.value) - (StringHandling.INSTR(row1.value,".",1,1)) != 3 ? 1 : 0  to flag the value based on your requirement

 

|value     |decimal_value|count_flag|

|=-------------+-------------+---------=|

|123345.567  |3      |0     |

|2345678905.789|3      |0     |

|6474747457.67 |2      |1     |

'--------------+-------------+----------'

 

Thanks & Regards,

Madhu Kolli