Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

BizTalk 2010 Recipes : Document Mapping - Using the Value Mapping Functoids

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/27/2011 8:43:39 PM

1. Problem

You need to understand how and when to use the Value Mapping and the Value Mapping (Flattening) functoids.

2. Solution

BizTalk provides two Value Mapping functoids: Value Mapping and Value Mapping (Flattening). Both will cause a new record to be created in the destination for every record in the source. The Value Mapping (Flattening) functoid is used when the destination document has a flat structure.

Both functoids require two input parameters: a Boolean value and the node that is to be mapped. If the Boolean value is true, the value will be mapped; otherwise, it will not be mapped.

The following steps demonstrate the use of the Value Mapping functoid in a map, using the source document shown in Listing 1.

Example 1. Source Document for the Value Mapping Functoid Example
<ns0:NewHireList xmlns:ns0="http://UsingValueMappingFunctoids.NewHireList">
<DateTime>DateTime_0</DateTime>
<Person>
<ID>1</ID>
<Name>Jonesy</Name>
<Role>.NET Developer</Role>
<Age>47</Age>
</Person>
<Person>
<ID>2</ID>
<Name>Scott</Name>
<Role>Database Developer</Role>
<Age>40</Age>
</Person>
<Person>
<ID>3</ID>
<Name>Austin</Name>
<Role>QA</Role>
<Age>33</Age>
</Person>
</ns0:NewHireList>

These steps refer to the Value Mapping functoid but are identical for the Value Mapping (Flattening) functoid.

  1. Click the Toolbox, and click the Advanced Functoids tab. Drop the Value Mapping functoid on the map surface between the source and destination schemas.

  2. The first parameter for the Value Mapping functoid needs to be a Boolean value. For this example, a Not Equal functoid will be used to generate the Boolean value. In the Toolbox, click the Logical Functoids tab, and drop a Not Equal functoid to the left of the Value Mapping functoid. The first input parameter for the Not Equal functoid should be the value from the Role element. The second input parameter should be a constant value. Set this value to QA. This will ensure that only those records that are not in this role will be mapped across. See Figure 1.

    Figure 1. Configuring the Not Equal functoid
  3. The second parameter for the Value Mapping functoid in this example is the Name element from the source document. Ensure that a line exists between this node and the functoid.

  4. Drop the output line from the Value Mapping functoid on the target node in the destination document.

Figure 2. Using the Value Mapping functoid

At this point, the map can be tested. Using the source document shown in Listing 1, output of the map is the document shown in Listing 2.

NOTE

If the Value Mapping (Flattening) functoid does not map a value across, the node is not created on the destination schema, whereas if the Value Mapping functoid does not map a value, an empty destination node will be created. To change this behavior, you will need to use additional functoids or scripting.

Example 2. Output Document Using the Value Mapping Functoid
<ns0:Company xmlns:ns0="http://UsingValueMappingFunctoids.Company">
<Employees>
<Employee>
<Name>Jonesy</Name>
</Employee>
<Employee>
<Name>Scott</Name>
</Employee>
<Employee>
</Employee>
</Employees>
</ns0:Company>

If the Value Mapping functoid is replaced with the Value Mapping (Flattening) functoid (as shown in Figure 3), the document in Listing 3 will be output.

Figure 3. Map with Value Mapping (Flattening) functoid

Example 3. Output Document Using the Value Mapping (Flattening) Functoid
<ns0:Company xmlns:ns0="http://UsingValueMappingFunctoids.Company">
<Employees>
<Employee>
<Name>Jonesy</Name>
<Name>Scott</Name>
</Employee>
</Employees>
</ns0:Company>

3. How It Works

This example showed the default behavior of the Value Mapping functoid. However, the default output of the Value Mapping functoids can be altered through the use of additional functoids and scripting. For example, notice that the output in Listing 3 is flat instead of nested (two Person nodes within the Employee node). By adding a Looping functoid to the Name element in the source document and attaching it to the Employee root node in the destination document (see Figure 4), you can obtain nested output, as in Listing 4. The output is identical to using the Value Mapping functoid as shown in Listing 2.

Figure 4. Using the Value Mapping (Flattening) and Looping functoids

Example 4. Output Using Value (Mapping) Flattening and Looping Functoids
<ns0:Company xmlns:ns0="http://UsingValueMappingFunctoids.Company">
<Employees>
<Employee>
<Name>Jonesy</Name>
</Employee>
<Employee>
<Name>Scott</Name>
</Employee>
<Employee>
</Employee>
</Employees>
</ns0:Company>

One of the most common situations in XML document mapping is working with nonexistent elements. By default, if an element does not exist in an incoming document but is mapped to the destination document in a BizTalk map, the node on the destination document will be created with a null value (<Node/>). The use of a Value Mapping (Flattening) functoid causes the node to be created in the destination document only if the source node exists in the source document.

Other -----------------
- BizTalk 2010 Recipes : Document Mapping - Mapping Any Element Nodes
- BizTalk 2010 Recipes : Document Mapping - Adding and Configuring Mapping Constants
- Windows Server 2003 : Troubleshooting Server Services (part 2) - Using Service Recovery Options to Diagnose and Resolve Service-Related Issues
- Windows Server 2003 : Troubleshooting Server Services (part 1) - Diagnosing and Resolving Issues Related to Service Dependency
- Windows Server 2008 Server Core : Virus and External Intrusion Protection (part 4) - Configuring Local Security Policies with the SecEdit Utility
- Windows Server 2008 Server Core : Virus and External Intrusion Protection (part 3) - Verifying Drivers with the Verifier Utility
- Windows Server 2008 Server Core : Virus and External Intrusion Protection (part 2) - Verifying System Files with the SFC Utility
- Windows Server 2008 Server Core : Virus and External Intrusion Protection (part 1)
- Windows Server 2008 Server Core : Managing System Users - Discovering User Identity with the WhoAmI Utility
- Exchange Server 2010 : Installing a Windows Certification Authority Server
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server