Microsoft KB Archive/292514

= PRB: Decimal Separators May Cause Parsing Errors in BizTalk Server 2000 =

Article ID: 292514

Article Last Modified on 8/5/2004

-

APPLIES TO


 * Microsoft BizTalk Server 2000 Standard Edition

-



This article was previously published under Q292514



SYMPTOMS
Many locales use a decimal separator other than a period (.). For example, five and three quarters may be represented as 5,75. When you attempt to use this format in BizTalk Server 2000, a document validation error may occur.



CAUSE
BizTalk Server converts data to XML for internal processing. XML only allows a period as a decimal separator. BizTalk Server does not automatically convert numeric fields to the required XML format.



RESOLUTION
To work around this behavior, specify the incoming field as a string, and then use a functoid in the BizTalk Mapper to convert this to a numeric format.

For details on how to implement this scenario, see the example in the &quot;More Information&quot; section of this article.



STATUS
This behavior is by design.



MORE INFORMATION
The self-extracting Separatorparse.exe file contains the sample files that are used in the following steps.

The following file is available for download from the Microsoft Download Center:

Download Separatorparse.exe now

The Separatorparse.exe file contains the following files:

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

Example
In this example, the incoming data is in a flat file format. The fields are separated with the number sign (#) character and the records are separated with a carriage return. There are two fields per record; the first is the product, and the second is the quantity, which is required in weight. The quantity is a floating point number with a comma as the decimal separator.

The following code represents an order with two items: (A sample input file is included in the download file Commadoc.txt.)
 * 1) Bananas#1,50
 * 2) Grapes#0,25

This code must be converted to the following XML format:     (Sample output is included in the download file Sampleoutput.xml.)

To perform this conversion, use the following steps:  Use the BizTalk Editor to write a document specification for the flat file format. Both fields of each record in this example are of type string and named &quot;Product&quot; and &quot;Weight.&quot;

(See the download file Flatcommspec.xml for an example of this document specification.) Use the BizTalk Editor to write a document specification for the XML format. The Produce field is of type string. The Tons field in the Item record in this example has a type of r4.

(For an example of this document specification, see the Xmloutputspec.xml download file.) In the BizTalk Messaging Manager, set up a document definition for these specifications named &quot;FlatFileOrder&quot; and &quot;XMLOrder&quot; respectively.</li> Create an envelope for the flat file specification named &quot;FlatFileEnvelope.&quot;</li> In the BizTalk Mapper, create a new map.

(For an example of this map specification, see the Mapstringtoreal.xml download file.)

Set the source document to the flat file specification and the destination document to the XML specification that you created in the previous steps.</li> Drag the Product field of the source document to the &quot;Produce&quot; field of the destination document.</li> Use the functoid palette to add a scriptor component.</li> Drag the Weight field from the source document and input it into the scriptor functoid.</li>  In the scriptor component, set the script to the following: Function MyFunction1( p_strParm0 ) MyFunction1 = Replace(p_strParm0, &quot;,&quot;, &quot;.&quot;) End Function </li> Drag the output from the scriptor to the Tons field in the destination document.

Note that the CDbl function in the Microsoft Visual Basic Script is internationally aware and recognizes decimal separators and thousand separators, depending on the locale settings. Therefore, you do not need to convert the commas to periods by using Replace. If the locale is set correctly, you can use the MyFunction1 = CDbl(p_strParm0) line instead.</li> Save the map as &quot;FlatToXMLMap.&quot;</li> Create the port to the destination where you want to send the resulting document.</li> Create a channel to the port named &quot;FlatOrderToXML.&quot; Set the incoming document definition to FlatFileOrder, and set the outgoing document definition to XMLOrder. Set the mapping that will be used to FlatToXMLMap .</li> Submit the sample document and specify the channel and envelope to use. The output document should match the sample XML code (shown above).</li></ol>

Additional query words: VBScript

Keywords: kbdownload kbgraphxlinkcritical kbprb KB292514

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.