Author |
Message
|
iam_wmbuser |
Posted: Tue Feb 17, 2009 3:27 am Post subject: FLOAT type represented in scientific notation |
|
|
 Newbie
Joined: 24 Jul 2008 Posts: 7
|
I have a flow that is using XMLNSC parser. The flow retrieves data from a Sybase database and formats the data using an ESQL module to build the output message tree which is manipulated using a map node then sent out on MQ as an XML message. An XSD was used to define the output message definition.
One of the fields returned by the stored procedure is of Float datatype, with a value of 14.0 exactly.
When the message is output to XML the float field is mapped into an xs:decimal type with totalDigits=15 and fractionDigits=6 but the value is rendered in scientific notation as 1.4E1.
Whilst this is strictly correct it is not what the users want.
How can I control the rendering of the float? Ideally it should render as 14.0
I tried to CAST the float to CHARACTER when setting it in the ESQL but this also rendered the field in scientific notation. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 17, 2009 3:33 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
kimbert |
Posted: Tue Feb 17, 2009 3:34 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
When the message is output to XML the float field is mapped into an xs:decimal type with totalDigits=15 and fractionDigits=6 but the value is rendered in scientific notation as 1.4E1. |
The facets on a simple type control how it is validated, but they do not affect how it is written.
Quote: |
I tried to CAST the float to CHARACTER when setting it in the ESQL |
That's the correct approach. Keep trying  |
|
Back to top |
|
 |
iam_wmbuser |
Posted: Tue Feb 17, 2009 4:38 am Post subject: RTM! |
|
|
 Newbie
Joined: 24 Jul 2008 Posts: 7
|
Apologies, I really should have RTM.
For completeness I used the following ESQL to get the required output:
Code: |
CAST (field AS CHARACTER FORMAT '##0.000') |
I have a more general question now: can you stop the default conversion of FLOAT to CHARACTER rendering in scientific notation?
Explicting casting is fine for a small number of fields but if there is a way of supressing scientific notation in general that would be better. |
|
Back to top |
|
 |
mgk |
Posted: Tue Feb 17, 2009 5:23 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
can you stop the default conversion of FLOAT to CHARACTER rendering in scientific notation? |
You can't as far as I am aware. You could change to use DECIMAL though which is a more accurate type and I think displays in non-scientific notation by default.
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|