This scenario explains how to create a BlueIntegrator Map, and how to use that Map with a Port or Workflow.
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Employee">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstName" type="xs:string" />
<xs:element name="Surname" type="xs:string" />
<xs:element name="Address1" type="xs:string" />
<xs:element name="Address2" type="xs:string" />
<xs:element name="City" type="xs:string" />
<xs:element name="Postcode" type="xs:string" />
<xs:element name="DateOfBirth" type="xs:dateTime" />
</xs:sequence>
<xs:attribute name="EmployeeId" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:schema>
Save this schema with name Employee.Assign Employee as the Source Schema, and Person as the Destination Schema. That is, our test map will map from an Employee Message to a Person Message.Double-click the Contant Functoid, and enter a space as the Constant value.
Drag a link from FirstName in the source tree to the left of the String Concatenate Functoid (to specify an input value). Then drag from the right hand side of the Contant Functoid (to get the output value) to the left of the String Concatenate Functoid (to specify an input value). Then drag a link from SurName in the source tree to the left of the String Concatenate Functoid (to specify an input value). You may need to reposition the Contact Functoid slightly to be able to do this easily.
Double click on the String Concatenate Functoid, and check the parameter values for the first three parameters are as expected.
Finally drag from the right hand side of the String Concatenate Functoid to the Name node of the destination tree.
This leaves us with one field to map – the date of birth from the Employee record onto the Age field of the Personrecord. We could use a Date Difference Functoid to do this, but instead we will use a Code Functoid to write custom code to do the job. To do this, first drag a Code Functoid from the Advanced Functoid section onto the Map surface.
Double click on the Code Functoid.
Type ConvertDOBToAge as the Functoid name and click Edit in VSTA…
You may be asked to select a default VSTA language (this example uses C#), and if this is the first time you have launched Visual Studio for Applications it could take up to a minute to generate the templates.
You will see that Visual Studio for Applications is launched, and a function has been generated for you to populate. Replace the implementation with that shown in the following screenshot (or Visual Basic equivalent).
Now return to the Map editor. All we have to do is drag a link from the DateOfBirth node of the source tree to the left (input) of the Code Functoid, and from the right side (output) of the Code Functoid to the Age node of the destination tree, and we’re done!