Author |
Message
|
6FA |
Posted: Thu Mar 03, 2016 9:35 pm Post subject: SOAP Decimal output |
|
|
Novice
Joined: 08 Jan 2016 Posts: 21
|
Hi guys,
I have an input XML value like 16.60. After passing it through SOAP request I'm getting this value as 16.6.
But my output should be 16.60.
How I cal get it?
I'm converting this XML to CSV. It is fine if I can do it while converting. Let me know if it is possible to do it with XSD. But while converting input is 16.6 and my output should be 16.60
Thanks  |
|
Back to top |
|
 |
Simbu |
Posted: Thu Mar 03, 2016 10:26 pm Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
Hi, please provide more information.
1. what is the version of IIB(WMB) you are using?
2. are you using Message Model for CSV conversion(MRM or DFDL)? |
|
Back to top |
|
 |
6FA |
Posted: Thu Mar 03, 2016 10:42 pm Post subject: |
|
|
Novice
Joined: 08 Jan 2016 Posts: 21
|
Hi Simbu,
1. I'm using IIB 9.0.0.3
2. I'm using DFDL |
|
Back to top |
|
 |
Simbu |
Posted: Thu Mar 03, 2016 11:53 pm Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
|
Back to top |
|
 |
6FA |
Posted: Fri Mar 04, 2016 12:27 am Post subject: |
|
|
Novice
Joined: 08 Jan 2016 Posts: 21
|
Hi simbu,
Thanks for the help.
I resolved it by adding ".00" to the input value  |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Mar 04, 2016 5:24 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
6FA wrote: |
Hi simbu,
Thanks for the help.
I resolved it by adding ".00" to the input value  |
That's the wrong way to resolve it. DFDL has a template for this, use it!  _________________ MQ & Broker admin |
|
Back to top |
|
 |
6FA |
Posted: Fri Mar 04, 2016 5:30 am Post subject: |
|
|
Novice
Joined: 08 Jan 2016 Posts: 21
|
Hi...,
Quote: |
That's the wrong way to resolve it. DFDL has a template for this, use it! |
How can I do it with DFDL?
can you suggest me the scenario. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Mar 04, 2016 5:38 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
6FA wrote: |
Hi...,
Quote: |
That's the wrong way to resolve it. DFDL has a template for this, use it! |
How can I do it with DFDL?
can you suggest me the scenario. |
When you define a number, there are templates on how that number should be formatted. Use them.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
timber |
Posted: Fri Mar 04, 2016 6:00 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
I have an input XML value like 16.60. After passing it through SOAP request I'm getting this value as 16.6 |
That's what you *should* get. 16.60 is one of an infinite number of ways in which the value 16.6 could be represented. The message tree holds logical values, not physical representations of values.
Quote: |
I resolved it by adding ".00" to the input value |
That's a hack, not a resolution of your problem. You should not try to control the physical representation using the logical message tree. As others have said, the DFDL model describes the physical representation of your CSV format.
Look in the DFDL editor and find the definition of this number. Set the Number Pattern property to #0.00. |
|
Back to top |
|
 |
6FA |
Posted: Fri Mar 04, 2016 7:05 am Post subject: |
|
|
Novice
Joined: 08 Jan 2016 Posts: 21
|
Hi Timber,
Quote: |
Set the Number Pattern property to #0.00 |
Thank you. It is working.
Actually This morning I tried this also, but in message tree it didn't showed as 16.60, It showed as 16.6
Now I checked in file after completion of the flow. Now I saw 16.60
So is this wrong way? I fixed this prob with below code.
DECLARE PriceAmount1 DECIMAL;
SET PriceAmount1 = '.00';
SET PriceAmount = CAST(PartsInventoryLine.ns:UnitPriceAmount AS DECIMAL) + PriceAmount1;
Thanks  |
|
Back to top |
|
 |
Vitor |
Posted: Fri Mar 04, 2016 7:43 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
6FA wrote: |
Actually This morning I tried this also, but in message tree it didn't showed as 16.60, It showed as 16.6
Now I checked in file after completion of the flow. Now I saw 16.60 |
Exactly. As my worthy associate pointed out, the message tree always holds the logical value not the physical representation. The logical value of 16.60 is 16.6.
The number pattern property is invoked during serialization to create the physical representation of the message tree. So at this point 16.6 becomes 16.60 as defined by the DFDL.
6FA wrote: |
So is this wrong way? I fixed this prob with below code. |
IMHO it's certainly not the best way. The DFDL is designed to handle this and if I was the guy 1 year from now who was tasked with making 16.60 look like 16.600 then I'd look in the DFDL first to make the change. I certainly wouldn't thank you for making me trawl through the code for every point you've formatted the output in ESQL. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|