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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to get decimals when divide two numbers

can anyone give me a tip how to get decimals when divide two numbers?
output is Double
I get the output 0.0
How do i get 0.1???
output_row.price =1.0/10
Labels (2)
4 Replies
Anonymous
Not applicable
Author

Hi,
If I understand you well, do you want to convert Double to Decimal after the divide operation?
Best regards
Sabrina
0683p000009MAr8.png
Anonymous
Not applicable
Author

can anyone give me a tip how to get decimals when divide two numbers?
output is Double
I get the output 0.0
How do i get 0.1???
output_row.price =1.0/10

Is this the real expression? You should not have an issue if your output row is defined as double.
You could try 1.0d/10d
But this expression looks okay to me
Your result suggests that you're getting and integer division that is then converted to a double
Anonymous
Not applicable
Author

Thanks!
A mixture between both worked:
new java.math.BigDecimal((double)(TalendDate.diffDate(rowHoved.TrombolyseStarttid,rowHoved.Innleggelsestidspunkt,"ss"))/3600d)
Anonymous
Not applicable
Author

Hi,
Thanks for your feedback.
Best regards
Sabrina