IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Decimals truncated in mapping Options · View
jonassam
Posted: Tuesday, July 2, 2019 3:34:45 PM
Rank: Newbie

Joined: 7/2/2019
Posts: 3
Hi Forum!
I use the format-number function to make sure to have two decimals on an number representing an amount. However, on the target input the decimals are stripped as can be seen in the attached screendump. I can't really understand the reason, so I hope that someone here might be able to help me out.

Best regards,
Jonas


jonassam attached the following image(s):
MapForce.jpg

island
Posted: Wednesday, July 3, 2019 3:55:19 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
Hi,

ensure that you have "Cast values to target types" unchecked:

https://www.altova.com/manual/Mapforce/mapforceenterprise/mff_xml_component_settings.htm?zoom_highlightsub=cast%2Bvalues

jonassam
Posted: Wednesday, July 3, 2019 7:40:41 AM
Rank: Newbie

Joined: 7/2/2019
Posts: 3
Thanks for you reply. I realised that I left out one crucial piece of information: Both the source and target are JSON schemas, not XML schemas. And for JSON components, that option does not exist. The strange this is that as can be seen in the screenshot, the output of the format function do have two decimals, and the target element is of type Number so to my understanding the truncation should not happen. I also have another target node in the schema of the same type where the source element has two decimals, and those are mapped correctly. So as I see it, the target node is a compatible type with the output of the function and no truncation should happen..

Best regards,
Jonas
jonassam
Posted: Wednesday, July 3, 2019 3:21:22 PM
Rank: Newbie

Joined: 7/2/2019
Posts: 3
After looking into this again it turns out that MapForce has the correct behaviour. In JSON, trailing zeroes are trimmed away. So 500.00 will become just 500. And 500.50 will become 500.5. So this turned out to be a non-issue.

Best regards,
Jonas
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.