BizTalk Mapper - Looping multiple nodes to map to a single node in a single row (flat file)

Hi everybody,

I'm still new in developing BizTalk app and require some help in this one problem. Appreciate your time and input to help me on this.

Basically I have an XML document as input and a flat file as output. Example for input is as per below. The "Contact" node's maxOccurs here is set to unbounded and could be multiple. (phone, fax, website, telex ...)

<root>
 <CustomerName>Company A</CustomerName>
 <Contact>
  <Type>Phone</Type>
  <Locator>03566789</Locator>
  <Type>Phone</Type>
  <Locator>03566790</Locator>
  <Type>Fax</Type>
  <Locator>03566795</Locator>
  <Type>Telex</Type>
  <Locator>03566798</Locator>
  <Type>Website</Type>
  <Locator>www.companyA.com</Locator> 
 </Contact>
</root>

The expected output in XML would look like below. The final outcome would be a csv file. Strictly Phone 1, phone 2, fax and telex, the rest would be ignored.

<root>
 <CustomerName>Company A</CustomerName>
 <Phone1>03566789</Phone1>
 <Phone2>03566790</Phone2>
 <Fax>03566795</Fax>
 <Telex>03566798</Telex>
</root>

Example of expected output result (csv file): CompanyName;Phone1;Phone2;Fax;Telex;
In our case here: Company A;03566789;03566790;03566795;03566798;
Another example could be: Company B;036778911;;036778912;; if only 1 phone number and 1 fax number provided.

I've used Table Looping and Table Extractor and nearly got the desired result except that it is represented in multiple rows instead of one: Example:

Company A;03566789;;;
Company A;;03566790;;;
Company A;;;03566795;;
Company A;;;;03566798;

Any idea how to do the mapping? I'm kind of stuck here and it sounds like an easy problem but i could not find any example to the solution that I need here. Table looping and table extractor is ok to map from single node flat file to multiple nodes but not the reverse like in this example.

rgds,
sportivo

March 19th, 2012 6:47am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics