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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
talendtester
Creator III
Creator III

[resolved] Need help with data validation logic

I am trying to validate the Latitude data.
How can I check if the cleaned latitude value is not alpha and within the desired latitude range?
My tmap logic so far:
( row1.LAT ==null
|| row1.LAT ==""
|| row1.LAT.length() <4
)? "":
( StringHandling.IS_ALPHA( row1.LAT.replaceAll("","").trim()
)== false
&& Integer.parseInt(row1.LAT.replaceAll("","").trim()) > 19.718234
&& Integer.parseInt(row1.LAT.replaceAll("","").trim()) < 70.306897835
)? (row1.LAT.replaceAll("","").trim()) : ""
ERROR MESSAGE
Exception in component tMap_1
java.lang.NumberFormatException: For input string: "51.1635"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at ...
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi
The input parameter "51.1635" can't be parsed to a int with method Integer.parseInt(), the characters in the input string must all be decimal digits, except that the first character may be an ASCII minus sign "-". Try to use method Double.parseDouble(),
Double.parseDouble(row1.LAT.replaceAll("","").trim()) > 19.718234
Best regards
Shong

View solution in original post

3 Replies
Anonymous
Not applicable

Hi
The input parameter "51.1635" can't be parsed to a int with method Integer.parseInt(), the characters in the input string must all be decimal digits, except that the first character may be an ASCII minus sign "-". Try to use method Double.parseDouble(),
Double.parseDouble(row1.LAT.replaceAll("","").trim()) > 19.718234
Best regards
Shong
talendtester
Creator III
Creator III
Author

That worked thanks.
Anonymous
Not applicable

Hi
Thanks for your feedback! 0683p000009MA9p.png
Best regards
Shong