|
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):
|
|
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
|
|
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
|
|
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
|
|
guest |