Author |
Message
|
Balaji_P |
Posted: Thu Sep 13, 2007 11:57 pm Post subject: Prooblem in Decimal Datatype |
|
|
Apprentice
Joined: 05 Sep 2006 Posts: 36 Location: Chennai
|
Hello all
I have a scenario where i am having a source side field with datatype(xsd:double) and i am mapping the field to target side which is of type decimal defined with precision(12,2).
In doing so, i am casting the field to decimal. I am able to see the exact value in debug i.e) if my source is 100.00 , i am able to see 100.00 but while wirting to queue it is cmng as 100.
Basically i am losing the deciaml point. i browsed the message in rfhutil and i am not bale to see the decimal point in the value.
any suggestion on this? |
|
Back to top |
|
 |
kimbert |
Posted: Fri Sep 14, 2007 1:33 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Which domain? If MRM, which physical format ( CWF / TDS / XML? ) |
|
Back to top |
|
 |
Balaji_P |
Posted: Fri Sep 14, 2007 1:57 am Post subject: |
|
|
Apprentice
Joined: 05 Sep 2006 Posts: 36 Location: Chennai
|
Hi kimbert
My domain is MRM and my physical format is CWF1 |
|
Back to top |
|
 |
kimbert |
Posted: Fri Sep 14, 2007 7:45 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
sri |
Posted: Mon Mar 16, 2009 9:33 pm Post subject: xsd:decimal - precision getting truncated when .00 |
|
|
 Apprentice
Joined: 14 Mar 2004 Posts: 32 Location: Chennai - India
|
Hi all
I too face the same problem of precision getting truncated when precision value is 0.
for example.
if the decimal field value is 24.89, it is coming correctly to the output queue. if the value is 24.00, in debug mode, i could see the field value as 24.00, but the same message when droped into the queue, it becomes 24.
.00 is getting truncated. But, as part of requirement i need to preserve the .00 also.
Iam using the MRM message set with XML parser.
field type is defined as xsd:decimal. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Mar 17, 2009 1:49 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Your problem is not the same as Balaji_P's. He is using CWF, whereas you are using MRM XML. The MRM XML parser does not allow you to control the output format of decimals. I suggest that you
- Change the data type of your element/attribute to xs:string
- Set the output value in your ESQL/Java. There are good facilities for parsing and writing numbers in both languages.
and
- Consider switching to XMLNSC if you are on v6.1 ( standard advice, nothing to do with this question ) |
|
Back to top |
|
 |
sri |
Posted: Wed Mar 18, 2009 11:20 pm Post subject: |
|
|
 Apprentice
Joined: 14 Mar 2004 Posts: 32 Location: Chennai - India
|
I have no option to change the field type to xsd:string.
I have tried the option of changing the mset to support xmlnsc and used xmlnsc instead of MRM, Still the parser trims off the zeros at the precision end. 2001.00 is getting converted to 2001.
If the domain is simple XML it is working as expected (2001.00 is coming out as 2001.00)
Is this the inbuilt feature of WMB to trim of the zeros at end of the precisions if the domain is MRM. |
|
Back to top |
|
 |
MQEnthu |
Posted: Thu Mar 19, 2009 12:14 am Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
sri wrote: |
I have tried the option of changing the mset to support xmlnsc and used xmlnsc instead of MRM, Still the parser trims off the zeros at the precision end. 2001.00 is getting converted to 2001. |
kimbert wrote: |
Consider switching to XMLNSC if you are on v6.1 ( standard advice, nothing to do with this question ) |
He just suggested to use XMLNSC domain for parsing XML messages if you are on V6.1 broker.
Do not use XML domain it is deprecated..
There is no option to keep the zeros after decimal in MRM-XML and in XMLNSC (as you said it is not working for XMLNSC).. where as you can control this in MRM-TDS message..
You will have to change the datatype to String to get the desired result... I do not think you have any other choice.. _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
kimbert |
Posted: Thu Mar 19, 2009 1:38 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I have no option to change the field type to xsd:string |
Why not? Can't you simply edit the message definition and change the data type of this element/attribute?
Quote: |
I have tried the option of changing the mset to support xmlnsc |
That will change nothing. The runtime parser is selected by the input node properties, or by an RFH2 header. The message set 'Primary domain' property is only used by the toolkit. In any case, that advice was not intended to be a solution this problem.
Quote: |
If the domain is simple XML it is working as expected (2001.00 is coming out as 2001.00) |
That's because the (deprecated) XML domain treats *everything* as a string. So does the XMLNSC domain, unless you enable validation and ask it to build the tree with non-string data types.
So switching to XMLNSC might still be a useful thing to do.
Quote: |
Is this the inbuilt feature of WMB to trim of the zeros at end of the precisions if the domain is MRM. |
It is not 'trimming' anything. The MRM parser reads the string value and puts it into the message tree as an INTEGER. That INTEGER value needs to be converted back to a string when the message hits an output node. The MRM parser outputs a correct string representation of the INTEGER value. There is no setting to allow you to specify the minimum precision, because very few applications would care.
It sounds as if your receiving application is being rather fussy about trailing zeros. |
|
Back to top |
|
 |
WMBEAI |
Posted: Thu Mar 19, 2009 3:34 am Post subject: |
|
|
Acolyte
Joined: 02 Mar 2009 Posts: 66
|
I guess using pattern #0.00 should work.
If the application is so stringent we can write a xsl function to implement this logic. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Mar 19, 2009 3:57 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
WMBEAI: I'm confused. Are you working with Balaji_P, and trying to solve the same problem?
If your remarks were important, please post again with much more explanation. |
|
Back to top |
|
 |
|