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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Null Handling while String to Float

I have a column in data source that I am mandated to convert to float. The column contains words so need to replace them empty strings which I am doing as Variable.

row3.Estimated_Sales_Price.replace("REFUSED","").replace("N/A","").equals("") ? null : row3.Estimated_Sales_Price.trim() 

then I am doing,

Var.var2 == null ? null : Float.parseFloat(Var.var2) 

I am getting error: java.lang.NullPointerException. I have tried everything but all have proved to be futile.

Any insights anyone please!!!!!!!!!

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Change to
row3.Estimated_Sales_Price == null || row3.Estimated_Sales_Price.replace("REFUSED","").replace("N/A","").equals("") ? null : row3.Estimated_Sales_Price.trim()

View solution in original post

4 Replies
TRF
Champion II
Champion II

Change to
row3.Estimated_Sales_Price == null || row3.Estimated_Sales_Price.replace("REFUSED","").replace("N/A","").equals("") ? null : row3.Estimated_Sales_Price.trim()
Anonymous
Not applicable
Author

Would love to give you Kudos but the option has been disabled under your post for some odd reason.
TRF
Champion II
Champion II

Same on other topic. Kudos are available only for questions, not answers. Sound like a bug.
Come back later 0683p000009MA9p.png
TRF
Champion II
Champion II

Hi,

Kudos are back 🙂