Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to set invalid decimal to 0

I have a input field which is of double data type.
I have to write a transformation for output field, that if my input is invalid number, set to my o/p field to 0.. how to do that..?

Labels (2)
2 Replies
Anonymous
Not applicable
Author

Hi,

 

     Could you please pass the input value to a double parse function and catch the exception based on the input value?

 

     Please refer the below link for the java pseudo code.

 

https://stackoverflow.com/questions/3133770/how-to-find-out-if-the-value-contained-in-a-string-is-do...

 

    Based on the boolean value, you can pass the original value or zero to the output column.

 

     If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂

 

Warm Regards,

 

Nikhil Thampi

TRF
Champion II
Champion II

As your input is a double, what is the criteria to decide that a number is invalid?