The following division in a Transformer stage results in zero.
Div(46528,86400)
Expected result = 0.538518519
I have tried data types (Length = 40, Scale = 30) of Decimal, Double, Float and Numeric without success.
Any help would be appreciated.
Simple division in Transformer stage results in zero
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 5
- Joined: Thu Apr 28, 2005 8:57 am
-
- Participant
- Posts: 232
- Joined: Sat May 07, 2005 2:49 pm
- Location: USA
Hi Paul,
If all you want to do is simple division, then you can use in your tranformer and it will work correctly
My guess is that when you do, the Div function treats the arguments as string and it expects a number.
If all you want to do is simple division, then you can use
Code: Select all
46528/86400
My guess is that when you do
Code: Select all
Div(46528,86400)
Thanks,
Naveen
Naveen
-
- Participant
- Posts: 5
- Joined: Thu Apr 28, 2005 8:57 am
-
- Participant
- Posts: 232
- Joined: Sat May 07, 2005 2:49 pm
- Location: USA
Hi Paul,
I tried this method in a server job, as I dont have access to parallel job right now and it works well. I wonder if its different in parallel jobs
I tried this method in a server job, as I dont have access to parallel job right now and it works well. I wonder if its different in parallel jobs
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
Code: Select all
46528/86400
Thanks,
Naveen
Naveen
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Div() performs integer division. It is documented as doing so. Wolfgang's solution using AsFloat is about as elegant as you're going to get (you may need to adjust the outer function according to your requirements, for example AsDecimal).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 5
- Joined: Thu Apr 28, 2005 8:57 am