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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to ignore everything after decimal dot?

Hello!

 

I get csvs and one column has an average in a strange format.

 

e.g.  12223.8 or 23422.99999999999

I would like to store 12223 or 23422 instead.

 

How can I remove the dot and everything after?

Labels (2)
1 Solution

Accepted Solutions
TharunJoshi
Contributor III
Contributor III

Hey even I do get in the same format I work in Customer Support Industry for this you just add this

row3.Handle_Time_Total_Seconds.intValue()

 

.intValue() will stop the values after the decimal point

 

View solution in original post

6 Replies
TRF
Champion II
Champion II

Convert from float or doubleto int. Should be enough.

Anonymous
Not applicable
Author

How?

When I try Double.parseDouble(row1.data).intValue()  I get an error.

 

Detail Message: The method parseDouble(String) in the type Double is not applicable for the arguments (Double)

TharunJoshi
Contributor III
Contributor III

Hey even I do get in the same format I work in Customer Support Industry for this you just add this

row3.Handle_Time_Total_Seconds.intValue()

 

.intValue() will stop the values after the decimal point

 

TRF
Champion II
Champion II

If row1.data is a string, then try the following expression:
row1.data.replaceAll("\..*$", "")
Anonymous
Not applicable
Author

Hi,

 

below code will give you an idea how to remove all character after dot from a decimal value.

Double a = 23422.99999999999;
System.out.println(a.intValue());

String b = "23422.99999999999";
System.out.println((int)Double.parseDouble(b));

You can write the above code in tjava component and run it.

 

--

Please give Kudos and mark topics as solved where appropriate.

Anonymous
Not applicable
Author

I'm new to Talend, but my next project involves a lot of csv imports and I think Talend would be the right tool for it, just need to understand it better.

 

Right now I kinda a bit feel stupid, because nothing seems to work.

Is there something I could do wrong with the csv?

 

tMap always throws an error, even when I say the data in the csv is double and I just want to save it in my DB as double without any cast.

 

Both (input / output) double "can't cast from int to double"

csv double - target int - using your tips "can't cast from string to int"