Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Another Map Question
- This topic has 3 replies, 1 voice, and was last updated 9 years, 6 months ago by
community-content.
-
AuthorPosts
-
-
December 11, 2006 at 6:35 AM #16828
Hello all,
What I'm doing involves looping. Don't panic, it's not that complicated – I just like detailed explanations. I have a flat
file schema (based on comma delinted repeating records, all of the same type)
Input: LegacyID1,Legacy1,LegacyID2,Legacy2,LegacyID3,Legacy3
These fields present themselves in pairs. LegacyID1 is a type code, and Legacy1 is a corresponding value. LegacyID1 won't exist without Legacy1, AND vice versa. The same thing goes for the LegacyID2/Legacy2 pair and the LegacyID3/Legacy3 pairs.
Pairs 2 and 3 are optional. For example, the input record could look like one of the following:
1C,334058,1C,W22192,1D,769475
or
1C,334012,1D,476600,,,
or
1D,1618735,,,,What I need to do is loop through the input (a flat file schema) and make a repeating group of <Repeated> nodes that look
like this:
<Repeated>
<PIDNumbers LID="1C" PValue="334058" />
</Repeated><Repeated>
<PIDNumbers LID="1C" PValue="W22192" />
</Repeated><Repeated>
<PIDNumbers LID="1D" PValue="769475" />
</Repeated>or
<Repeated>
<PIDNumbers LIDr="1C" PValue="334012" />
</Repeated><Repeated>
<PIDNumbers LID="1D" PValuer="476600" />
</Repeated>or
<Repeated>
<PIDNumbers LID="1D" PValue="1618735" />
</Repeated>respectively.
I have no problem writing the loop which creates the correct number of <Repeated> nodes based on the number of LIDs in the input file. I just created a loop on LegacyID1,LegacyID2,LegacyID3 and added conditions on LegacyID2,LegacyID3 checking for length > 0. I can also correctly populated the LID values (by linking all three on the left to my destination attribute on the right). The problem I'm having is correctly populating Legacy1, Legacy2, and Legacy3. If I just do the same thing I did with LegacyID1,LegacyID2,LegacyID3 and link Legacy1,Legacy2,Legacy3 to my other destination attribute on the right, it just takes the last one (even when it is blank on the left). In the first example above, all three PValues come out as 769475, but everything else it correct. Not what I want. What I need is to have Legacy1 go along with LegacyID1, and, IF AND ONLY IF LegacyID2 exists, create another <Repeated> node, and populate it with LegacyID2 and Legacy2 attributes. Same goes for the third.
Any help would be greatly appreciated.
Thanks
-
December 11, 2006 at 12:21 PM #16837
I figured it out (I think). Use the table loop and table extractor functoids.
-
December 12, 2006 at 12:14 AM #16843
For this input:
1C,334058,1C,W22192,1D,769475
How did you create this xml file.Can you post the xsd(schema) here
<Repeated>
<PIDNumbers LID="1C" PValue="334058" />
</Repeated><Repeated>
<PIDNumbers LID="1C" PValue="W22192" />
</Repeated><Repeated>
<PIDNumbers LID="1D" PValue="769475" />
</Repeated>-
December 12, 2006 at 12:43 AM #16845Here is the Schema:-<?xml version="1.0" encoding="utf-16" ?>– <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://DummyFlatFile.FlatFileSchema1" targetNamespace="http://DummyFlatFile.FlatFileSchema1" xmlns:xs="http://www.w3.org/2001/XMLSchema"><b:schemaInfo standard="Flat File" root_reference="Root1" default_pad_char="" pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" /><schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" /></xs:appinfo></xs:annotation><b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_delimiter_type="char" child_order="infix" child_delimiter="," /></xs:appinfo></xs:annotation><b:recordInfo sequence_number="1" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_delimiter_type="char" child_delimiter="," child_order="infix" /></xs:appinfo></xs:annotation></xs:sequence></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element></xs:schema>
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.