Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Combining data from 2 related input records
- This topic has 3 replies, 1 voice, and was last updated 9 years, 3 months ago by
community-content.
-
AuthorPosts
-
-
December 8, 2006 at 8:33 PM #16798
Hello,
I'm very new to BizTalk.
I have an input flat file that looks like this:
Header record
Invoice A header record
Product 1 for Invoice A record
Serial Number record for Product 1
Product 2 for Invoice A record
Invoice B header record
Product 3 for Invoice B record
Serial Number record for Product 3
etc
I.e. Each product record may be followed by an optional Serial number record. There is also a line item number field on both the Product and Serial Number record to match the two records. All records have a tag identifier.
I would like to create an output flat file consisting of records for each product. This would be built from fields from the Invoice, Product and Serial Number records – i.e. flatten the invoice.
In the BizTalk map I have managed to create an input xml schema and using the looping functoid link the product record to the output record. However I cannot correctly output the serial number field from the serial number to the output record. When I connect the serial# field to the corresponding field in the output record it uses the data from the first Serial number record for all other products in the same invoice. I also tried connecting the Serial Number record to the looping functoid but that produced incorrect number of output records.
Is it possible to show the Product and Serial Number relationship in the mapping?
In BizTalk is it possible to combine data from 2 separate schemas and output to 1 schema?
Or do I create 2 output schemas, 1 for Product and 1 for Serial number and push these into 2 tables, then run SQL to join these 2 tables in order to achieve the desired output?
Any help would be very much appreciated.
Cheers
Stable
-
December 9, 2006 at 12:07 PM #16804
If your product line and serial number line are sibling records then you will need to use a custom Xslt and the xsl:key element.
However, an easier way may be to change the flat file schema.
Header record
Invoice A header record
Line
Product 1 for Invoice A record
Serial Number record for Product 1
Line
Product 2 for Invoice A record
Invoice B header record
Line
Product 3 for Invoice B record
Serial Number record for Product 3i.e. create a Line record which has a child Product record and an optional Serial number record.
In the map connect the Line record to the Looping functoid to the output record.
-
December 9, 2006 at 7:43 PM #16808
Thanks Greg.
With the flat file schema and mapping as you suggested I only get 1 output record for Invoice A (expected 2 records) . When I connect the looping funtoid from product record to the output record I get the correct number of output records for each invoice but incorrect serial number on the 2nd product of the invoice.
I have now also connected the looping functoid from the sibling Serial Number record to the output record. The XML output now consists of all product records plus the serial number records that exists (different record formats for each record type but each record containing fields to uniquely identify the invoice and line item number).
I've also looked at Stephen Thomas' Sorting, Grouping, and Debatching in Pure Messaging Sample for BizTalk 2004. Will try to sort and group the records by products using the invoice number and line item number as the key.
Can anyone tell me how to define an xsl composite key ?
After the records are grouped by composite key, I somehow need to output the data from the grouped records to one record per group in a flat file. Any hints for this step?
Cheers
Stable
-
December 9, 2006 at 11:39 PM #16811
Stable,
Can you email me your two schemas, map and an example flat file
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.