Problem with String to decimal
Moderators: chulett, rschirm, roy
Problem with String to decimal
Hi All,
I have this job which is reading data as just one column
I parsed this filed based on the specified fields
I have this one field which should be of type decimal [7,2]
But when i convert the string to decimal it is giving as '0000.00'
though there is other values in it
here's one example
the data which is read as one field of type varchar() & length 320 is
'XA0 7888610000 010101050000008 112460007770000000000000000000000000000000000000000000000000000 '
And the field that should be decimal is extracted thi sway
StringToDecimal(DSLink2.VISIONDATA[78,7])
and i have defined it as datatype decimal length 7 scale 2
and within the field definition
Field Level
delimiter : none
Start position : 78
Decimal Type
Precision: 2
Field width: 7
The job runs successfully but the value that the above filed hold is
00000.00
where as the data it stores at that position is 0077700
Any input on how to fix this problem
Any help would be highly appreciated
I have this job which is reading data as just one column
I parsed this filed based on the specified fields
I have this one field which should be of type decimal [7,2]
But when i convert the string to decimal it is giving as '0000.00'
though there is other values in it
here's one example
the data which is read as one field of type varchar() & length 320 is
'XA0 7888610000 010101050000008 112460007770000000000000000000000000000000000000000000000000000 '
And the field that should be decimal is extracted thi sway
StringToDecimal(DSLink2.VISIONDATA[78,7])
and i have defined it as datatype decimal length 7 scale 2
and within the field definition
Field Level
delimiter : none
Start position : 78
Decimal Type
Precision: 2
Field width: 7
The job runs successfully but the value that the above filed hold is
00000.00
where as the data it stores at that position is 0077700
Any input on how to fix this problem
Any help would be highly appreciated
-
- Premium Member
- Posts: 644
- Joined: Sat Aug 26, 2006 3:59 pm
- Location: Mclean, VA
Re: Problem with String to decimal
Hi,
I believe
DSLink2.VISIONDATA[78,7] is doing substring so you are getting exact 7 values '0000.00' from 78th position
I the arguments for StringToDecimal is (String,rtype)
where rtype is ceil or floor.
I believe
DSLink2.VISIONDATA[78,7] is doing substring so you are getting exact 7 values '0000.00' from 78th position
I the arguments for StringToDecimal is (String,rtype)
where rtype is ceil or floor.
sshettar wrote:Hi All,
I have this job which is reading data as just one column
I parsed this filed based on the specified fields
I have this one field which should be of type decimal [7,2]
But when i convert the string to decimal it is giving as '0000.00'
though there is other values in it
here's one example
the data which is read as one field of type varchar() & length 320 is
'XA0 7888610000 010101050000008 112460007770000000000000000000000000000000000000000000000000000 '
And the field that should be decimal is extracted thi sway
StringToDecimal(DSLink2.VISIONDATA[78,7])
and i have defined it as datatype decimal length 7 scale 2
and within the field definition
Field Level
delimiter : none
Start position : 78
Decimal Type
Precision: 2
Field width: 7
The job runs successfully but the value that the above filed hold is
00000.00
where as the data it stores at that position is 0077700
Any input on how to fix this problem
Any help would be highly appreciated
Attitude is everything....
try defining your target column to [9,2] or [7,0] and not [7,2]
Last edited by mikegohl on Thu Aug 21, 2008 2:48 pm, edited 2 times in total.
Michael Gohl
Thank for all the prompt replies
Well i found a work around for this
I instead did the following
in the derivation for the field i gave
DSLink2.VISIONDATA[78,5]:'.':DSLink2.VISIONDATA[83,2]
and i read it as decimal 7.2
It worked for
though tis giving me the output i wanted ie 00777.00
Dont know if this is right???
Thanks
Well i found a work around for this
I instead did the following
in the derivation for the field i gave
DSLink2.VISIONDATA[78,5]:'.':DSLink2.VISIONDATA[83,2]
and i read it as decimal 7.2
It worked for
though tis giving me the output i wanted ie 00777.00
Dont know if this is right???
Thanks