BizTalk Mapper allows you to map fields and records from one specification to fields and records in another specification. BizTalk Mapper uses links and functoids. A link is a simple copy operation from the value in one field to the value in another field. A link can also copy to a functoid. A functoid is an object that allows for complex structural manipulation operations between source elements and destination elements. Before a specification can be used in BizTalk Mapper, it needs to be defined in the BizTalk Editor. BizTalk Mapper supports EDI, flat files, XML files, schemas, and even ADO recordsets. BizTalk Mapper can also create XSL style sheets for mapping.
As an example of how to use BizTalk Mapper, we will use two PO specifications that come with BizTalk Server 2000. To see how BizTalk Mapper works, follow these steps:
By connecting source and destination fields, you can create a map between a source and a destination specification. If you now connect other fields, you can go to the Tools menu and choose Compile Map to produce XSL code that will create the transformation between the two specifications. Figure 16-5 shows the XSL code generated in the Output tab on the bottom of the BizTalk Mapper after linking several other fields and then compiling.
Figure 16-4. Microsoft BizTalk Mapper.
Figure 16-5. The Output tab showing the XSL code after compiling.
As mentioned, you can use functoids to perform complex structural transformations between source elements and destination elements. Functoids use predefined formulas and specific values to perform calculations. You can select functoids from the Functoid Palette. To work with functoids, follow these steps:
Figure 16-6. The Script tab in the Functoid Properties window.
In our case, the function FctMathMultiply1 is defined in the following code:
Function FctMathMultiply1( p_strParm0 ) If ( IsNumeric( p_strParm0 ) ) Then FctMathMultiply1 = CStr ( CDbl( p_strParm0 ) ) Else FctMathMultiply1 = "" End If End Function |
As you can see, the function is just a template. You will need to fill in the necessary functionality to make this function work. In the pre-release version of the BizTalk Mapper, this script cannot be edited in the Functoid Properties window. However, you can go to the Advanced tab of the Functoid Palette to edit the script. (You might need to scroll over to see the Advanced tab.) Get the Custom Visual Basic Script from the Advanced tab and drop it on the grid, make a connection from a field in the source document to a field in the destination document, and then edit the script. A custom transformation will be created between the source field and the destination field.
As you can see, functoids make it easy to do transformations. When the map is compiled by choosing Compile Map from the Tools menu, the XSL script will include functions to perform these transformations.