BizTalk Server Tools - One to many in Biztalk 2004 maps

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Tools > November 2004 > One to many in Biztalk 2004 maps





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author One to many in Biztalk 2004 maps
David Grospelier

2004-11-04, 2:46 am

Hi,

I have two schemas and I want to map them together.

Here is a sample of a source XML :
<root>
<item1>value_item1</item1>
<item2>value_item2</item2>
</root>

The destination XML should look like this :
<destination>
<items_to>
<item>
<code>value_item1</code>
</item>
</items_to>
<items_from>
<item>
<code>value_item2</code>
</item>
</items_from>
</destination>

I've created a map but when I validate it, I have warnings like "warning
btm1026: Detected condition where compiled output could contain more than
one child node of equivalent node. You must use logical functoids to
make sure only one child of equivalent node is created.".

If I test the map, I get this xml :

<destination>
<items_to>
<item>
<code>value_item1</code>
</item>
<item><code/></item>
</items_to>
<items_from>
<item>
<code>value_item2</code>
</item>
<item><code/></item>
</items_from>
</destination>

I don't know what to do !

Any help would be greatly appreciated !


--
David Grospelier
Chef de projets
Sword Group - www.sword.fr
Tan Bao Nguyen

2004-11-04, 5:48 pm

David,

Use the index functoid to retreive the first and second item and then link
the corresponding link to the destination field. Please refer to the BTS
doc for more info on the index functoid.

Regards,
Tan Nguyen
Microsoft BizTalk Server

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------[vbcol=seagreen]
cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
.phx.gbl[vbcol=seagreen]

Mike Jansen

2004-11-05, 5:48 pm

Here's a neat trick I figured out: Make an orchestration and drop a
transform message shape. Set the source as the two source schemas and the
destination as the one destination schema. Then choose to make a new map --
you get the map editor with 2 source schemas I haven't looked into what
it's actually doing behind the scenes (I think it does an import of both
schemas) but it does work. So maybe you could create a third schema that
imports the two source schemas and then use that in your map. If you need
more details, let me know.

Here's the XML for the .BTM file for a sample of it I just generated. It
creates a schema write in the map that includes the 2 source schemas.

<?xml version="1.0" encoding="utf-16" ?>

<!-- Generated using BizTalk Mapper on Fri, Nov 05 2004 01:43:42 PM -->

<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->

<mapsource Name="BizTalk Map" BizTalkServerMapperTool_Version="2.0"
Version="2" XRange="100"

YRange="420" OmitXmlDeclaration="Yes" CopyPIs="No" method="xml"
xmlVersion="1.0" IgnoreNamespacesForLinks="Yes">

<SrcTree>

<xs:schema
xmlns:tns="http://schemas.microsoft.com/BizTalk/2003/aggschema"
xmlns:ns2="http://two_source_map.source2"

xmlns:ns1="http://two_source_map.source1"
xmlns:b="http://schemas.microsoft.com/BizTalk/2003"

targetNamespace="http://schemas.microsoft.com/BizTalk/2003/aggschema"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:import schemaLocation=".\source1.xsd"
namespace="http://two_source_map.source1" />

<xs:import schemaLocation=".\source2.xsd"
namespace="http://two_source_map.source2" />

<xs:element name="Root">

<xs:complexType>

<xs:sequence>

<xs:element name="InputMessagePart_0">

<xs:complexType>

<xs:sequence>

<xs:element ref="ns1:root-src-1" />

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="InputMessagePart_1">

<xs:complexType>

<xs:sequence>

<xs:element ref="ns2:root-src-2" />

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:schema>

</SrcTree>

<TrgTree>

<Reference Location=".\dest.xsd" />

</TrgTree>

<ScriptTypePrecedence>

<CSharp Enabled="Yes" />

<ExternalAssembly Enabled="Yes" />

<VbNet Enabled="Yes" />

<JScript Enabled="Yes" />

<XsltCallTemplate Enabled="Yes" />

<Xslt Enabled="Yes" />

</ScriptTypePrecedence>

<TreeValues>

<TestValues />

<ConstantValues />

</TreeValues>

<Pages>

<Page Name="Page 1">

<Links>

<Link LinkID="1"
LinkFrom="/*[local-name()='&lt;Schema&gt;']/*[local-name()='Root']/*[local-n
ame()='InputMessagePart_0']/*[local-name()='root-src-1']/*[local-name()='nod
e-src-1']"


LinkTo="/*[local-name()='&lt;Schema&gt;']/*[local-name()='dest']/*[local-nam
e()='node1']"

Label="" />

<Link LinkID="2"
LinkFrom="/*[local-name()='&lt;Schema&gt;']/*[local-name()='Root']/*[local-n
ame()='InputMessagePart_1']/*[local-name()='root-src-2']/*[local-name()='nod
e-src-2']"


LinkTo="/*[local-name()='&lt;Schema&gt;']/*[local-name()='dest']/*[local-nam
e()='node2']"

Label="" />

</Links>

<Functoids />

</Page>

</Pages>

</mapsource>



Mike Jansen
Prime ProData, Inc.
North Canton, Ohio USA
(mjansen) [at] (primepro-com)


"David Grospelier" <dgrospelier@sword-group.com> wrote in message
news:Xns95976236D33CCdgrospelierswordgro
u@207.46.248.16...
> Hi,
>
> I have two schemas and I want to map them together.
>
> Here is a sample of a source XML :
> <root>
> <item1>value_item1</item1>
> <item2>value_item2</item2>
> </root>
>
> The destination XML should look like this :
> <destination>
> <items_to>
> <item>
> <code>value_item1</code>
> </item>
> </items_to>
> <items_from>
> <item>
> <code>value_item2</code>
> </item>
> </items_from>
> </destination>
>
> I've created a map but when I validate it, I have warnings like "warning
> btm1026: Detected condition where compiled output could contain more than
> one child node of equivalent node. You must use logical functoids to
> make sure only one child of equivalent node is created.".
>
> If I test the map, I get this xml :
>
> <destination>
> <items_to>
> <item>
> <code>value_item1</code>
> </item>
> <item><code/></item>
> </items_to>
> <items_from>
> <item>
> <code>value_item2</code>
> </item>
> <item><code/></item>
> </items_from>
> </destination>
>
> I don't know what to do !
>
> Any help would be greatly appreciated !
>
>
> --
> David Grospelier
> Chef de projets
> Sword Group - www.sword.fr



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com