<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Integration Engineer &#187; Mapping Exercise</title>
	<atom:link href="http://www.theintegrationengineer.com/category/mapping/mapping-exercise/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.theintegrationengineer.com</link>
	<description>When it just has to work.</description>
	<lastBuildDate>Tue, 27 Jul 2010 17:33:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mapping Excersize: 832 to DB</title>
		<link>http://www.theintegrationengineer.com/mapping-excersize-832-to-db/</link>
		<comments>http://www.theintegrationengineer.com/mapping-excersize-832-to-db/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 22:54:29 +0000</pubDate>
		<dc:creator>Roy</dc:creator>
				<category><![CDATA[Mapping Exercise]]></category>
		<category><![CDATA[832]]></category>
		<category><![CDATA[EDI]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[Mapping]]></category>

		<guid isPermaLink="false">http://www.theintegrationengineer.com/?p=896</guid>
		<description><![CDATA[Its time for another mapping exercise.  This time we will receive an EDI 832 in 4010 format, and map the data to a DB or flat file.  Getting catalog data into your procurement system is an important task.  And creating  variety of mapping exercises provides us with a better understanding of how mapping projects work [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-276" title="mapping_pzl" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/07/mapping_pzl.jpg" alt="mapping pzl Mapping Excersize: 832 to DB" width="200" height="108" />Its time for another mapping exercise.  This time we will receive an EDI 832 in 4010 format, and map the data to a DB or flat file.  Getting catalog data into your procurement system is an important task.  And creating  variety of mapping exercises provides us with a better understanding of how mapping projects work than just having one that tries to be everything.  And mapping is one of the fun things that we get to do.  Following this exercise we will have worked through the the common issues and demonstrated how this process comes together.</p>
<p><strong>Mapping Steps </strong></p>
<p>There are five steps to this mapping process.  Here is a list with a brief description of each one;</p>
<ul>
<li><em>Defining the target</em>:  This is the first step to mapping.  We must know where we are going if we plan on getting there.  And using a <a href="http://www.theintegrationengineer.com/data-mapping/">Target based mapping</a> process we decrease the time and efort of the other steps.</li>
<li><em>Defining the Data Source</em>:  This is the second step to mapping.  Once we know what the target looks like, we know what data we need to complete it.  So this naturally leads us to defining the source(s) of the data.  This can be a single input data file or record, or it can be multiple types of data from multiple sources.</li>
<li><em>Defining the Processes</em>:  Some of the data that we will need in our target will not be in the proper form or format in the source.  We will have to have a process defined in our map to convert the source data into the correct form for the target format.</li>
<li><em>Handling customisation Points</em>:  When we are mapping data, we will see points where we will want to make a decision on what to do.  Not all data is created or received in an equal form.  Thus we may have points in our mapping process where we will need to do a different process depending on the source or content of the data.</li>
<li><em>Monitoring the Process</em>:  After we have created a mapping process we will need to monitor it so that we can know when something unexpected happens.  To do this we must identify the right places in the mapping process for it to report its status to a monitoring process.  This is the last step in the mapping process.</li>
</ul>
<p><strong>Catalog Target</strong></p>
<p>If you have a catalog, then you will have your own schema.  We are getting our schema from a standard Open Office DB template.  This way you can create your own version for this exercise.</p>
<p>The Product table in the Open Office Business table has these fields:</p>
<ul>
<li>ID, INT</li>
<li>CategoryID, INT</li>
<li>Discontinued, BOOLEAN</li>
<li>LeadTime, VARCHAR</li>
<li>ProductID, INT</li>
<li>ProductDescription, VARCHAR</li>
<li>ProductName, VARCHAR</li>
<li>ReorderLevel, INT</li>
<li>Serialnumber, VARCHAR</li>
<li>SupplierID, INT</li>
<li>UnitPrice, DECIMAL</li>
<li>UnitsInStock, INT</li>
<li>UnitsOnOrder, INT</li>
</ul>
<p>These are the basic fields that we will be inserting data into.  We will probably have a process that will validate the supplier ID before inserting new records, but that will come in during the process step.</p>
<p><strong>Next Steps</strong></p>
<p>Following defining our target, we will define our source.  But we will do that in the next instalment of this exercise.   <a href="http://www.theintegrationengineer.com/wp-content/uploads/2009/02/basepapermap.xls">Download</a> and create start your paper map now, we will show them in the next post as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theintegrationengineer.com/mapping-excersize-832-to-db/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Agile Mapping</title>
		<link>http://www.theintegrationengineer.com/agile-mapping/</link>
		<comments>http://www.theintegrationengineer.com/agile-mapping/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 16:12:24 +0000</pubDate>
		<dc:creator>Roy</dc:creator>
				<category><![CDATA[Mapping Exercise]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[post process]]></category>
		<category><![CDATA[pre process]]></category>
		<category><![CDATA[Trading Partner]]></category>
		<category><![CDATA[Vendor]]></category>

		<guid isPermaLink="false">http://www.theintegrationengineer.com/?p=894</guid>
		<description><![CDATA[If you have just a few Trading Partners, having a unique and separate map for each of them might be a good option.  However, if you have plans to scale your integration to 10s, 20s, or 100s and 1000s of trading partners, having a one map to one trading partner strategy is a recipe for [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-912" title="Agile-Mapping-GPS" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/11/Agile-Mapping-GPS.jpg" alt="Agile Mapping GPS Agile Mapping" width="175" height="109" />If you have just a few Trading Partners, having a unique and separate map for each of them might be a good option.  However, if you have plans to scale your integration to 10s, 20s, or 100s and 1000s of trading partners, having a one map to one trading partner strategy is a recipe for a difficult to maintain and support integration solution.  And it doesn&#8217;t have to be this way.  There are a few strategies that will help you create an integration that will scale and be easy to support.</p>
<p><span id="more-894"></span></p>
<p><strong>Industries have common ways to handle data.</strong></p>
<p>This is something that we should understand.  Mandating that others use your standard usage implementation may work if you are Wal-Mart, but is not really necessary.  Most supply chain integrations are industry specific.  Probably most EDI integrations even the non-supply chain ones are also industry specific.  And you will find that most of the Trading Partners in a industry need to use the same data sets.  And you will find that most of them are using them in about the same way.</p>
<p>What this means is that when you set up a map for one Trading Partner, most of that mapping will also work for the next one.  This allows us to write maps that are flexible and can handle the variations in the data without having to have a map for each partner, or a crazy set of conditions that say, For Trading Partner 1 do xyz.&#8221;</p>
<p>This is of course for an inbound process of in other words, EDI data we receive from others.  And it is simple to accept a par number of other piece of data in more than one location and map that to our canonical.</p>
<p>What is more tricky to visualize is how this works on the outbound.  Well it is possible to map a part number or other piece of data to more than one location, this can be confusing to the trading partners that are receiving it.  Instead, we do a pre map manipulation or pre mapping for trading partners that step out of the normal map.  We could also have a post map process if your technology makes that the better choice.</p>
<p>Here is how that will look. First, we will have a map that is our standard preferred mapping.  This map takes our canonical data and maps it into our outbound EDI format.  Next, we create a process that will either modify the structure or content of our canonical to reflect the custom needs.  We also adjust the map to recognize and handle the new fields. Alternatively we could have a post map that maps our standard outbound EDI and alters data or structure.</p>
<p><strong>Strategies:</strong></p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;"><em>1.  Broad mapping:</em></span></p>
<p style="padding-left: 30px;">This is a mapping strategy that I have found works well on mapping data received well from Trading Partners.  One illustration can be found in the discussion of<a href="http://www.theintegrationengineer.com/line-item-part-one-po1/"> line item data</a>.   Where a specific piece of data may be found in more than one location, you create your map to accept this data in all of the valid locations and out put that into your canonical.</p>
<p style="padding-left: 30px;">It is also possible to do this on the outbound or map that formats data for consumption by your Trading Partners.  This is not as straight forward, but there are times when you can see conditions in the data that cause the format or output to change.  When these conditions exist, include them in the mapping and you will have a more agile and flexible map.</p>
<p style="padding-left: 30px;"><em><span style="text-decoration: underline;"> 2.  Pre mapping:</span></em></p>
<p style="padding-left: 30px;">This is a map before the map.  Well it doesn&#8217;t really have to be a whole map.  But the concept is this;  Data received or sent to a Trading Partner needs to be changed on a more Trading Partner specific basis.  It doesn&#8217;t actually need to be a TP condition, these pre maps can detect a data format, and alter it before sending it to the map.</p>
<p style="padding-left: 30px;">For instance, I had a instance where we had a TP that was consistently sending us a DUNS number with the ID of &#8220;1&#8243; and we needed &#8220;01&#8243; for our system.   So we put together a pre-process that would look for these qualifiers of &#8220;1&#8243; and altered it to &#8220;01&#8243;.  In this way our map didn&#8217;t have to have funky code, and we were able to integrate with these trading partners without having to ask them to change their vendor data in their DB that was trimming leading zeroes.  In any case, I have found that pre mapping is useful when there are consistent standards violations or data manipulation that can be corrected systematically.</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;"><em>3.  Post mapping:</em></span></p>
<p style="padding-left: 30px;">This is similar to the pre mapping, but your process happens after the map.  This is a good use for mapping data out to your Trading Partner.  And again, they don&#8217;t have to be trading partner specific.  Data going out is altered slightly in form or format before it is delivered.</p>
<p style="padding-left: 30px;">Again, I had a trading partner that transmitted catalog and part lookups in a format with a dash in the part number.  But they didn&#8217;t like getting the dash back on their orders.  So we instituted a simple mapping change that would strip dashes for them.  But later we realized that having a process to fix part number formats was something that more than one Vendor Trading Partner was requesting.  So we moved the mapping condition to a post mapping process that would look at the TP and find any part number rule and apply it.</p>
<p><strong>Flexible and Agile is just better.</strong></p>
<p>Okay, so that is a broad generalization.  But I can back it up with years of experience.  I never regret mapping broadly and implementing pre and post processes.  But I do regret when I have mapped narrowly, tried to have a single trading partner specific map, or include all types of TP specific logic into a map.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theintegrationengineer.com/agile-mapping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mapping Excersizes: EDI Invoice to Open Office Tables (part Two)</title>
		<link>http://www.theintegrationengineer.com/mapping-excersizes-edi-invoice-to-open-office-tables-part-two/</link>
		<comments>http://www.theintegrationengineer.com/mapping-excersizes-edi-invoice-to-open-office-tables-part-two/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 03:33:44 +0000</pubDate>
		<dc:creator>Roy</dc:creator>
				<category><![CDATA[Mapping Exercise]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[EDI]]></category>
		<category><![CDATA[Invoice]]></category>
		<category><![CDATA[Mapping]]></category>
		<category><![CDATA[Open Office]]></category>

		<guid isPermaLink="false">http://www.theintegrationengineer.com/?p=149</guid>
		<description><![CDATA[Continuing Mapping Exercise
Today we will identify our data source, and begin mapping the source data to the target data.  We identified our target format and placed that in the paper map last time.  If you didn&#8217;t read that post yet, you might want to review it quickly before continuing.  (read part One)

The Source
The source is [...]]]></description>
			<content:encoded><![CDATA[<p><strong><img class="alignleft size-full wp-image-276" title="mapping_pzl" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/07/mapping_pzl.jpg" alt="mapping pzl Mapping Excersizes: EDI Invoice to Open Office Tables (part Two)" width="201" height="108" />Continuing Mapping Exercise</strong></p>
<p>Today we will identify our data source, and begin mapping the source data to the target data.  We identified our target format and placed that in the paper map last time.  If you didn&#8217;t read that post yet, you might want to review it quickly before continuing.  (<a href="mapping-excersizes-edi-invoice-to-open-office-tables-part-one">read part One</a>)</p>
<p><span id="more-149"></span></p>
<p><strong>The Source</strong></p>
<p>The source is an EDI Invoice.  We will pick an X12 4010 810 as our standard, and I am providing you a link to the Standards document here.  This is a sample standard and does not contain an exhaustive list of elements, just the ones that we are using.   <a href="http://www.theintegrationengineer.com/wp-content/uploads/2009/07/TIE810.pdf">TIE810</a></p>
<p>We then insert the source elements for the data that we have in this way, starting with the most straight forward data.  I am starting at the bottom and going up.  IT1_04 is the Unit Price.  And it will map directly.  So do ProductID and Quantity.  Quantity from IT1_02 and Product ID from IT1_07 where IT1_06 is &#8220;VC&#8221; (I will also look on down the line at other odd numbered elements greater than 7 that have a preceding qualifier of &#8220;VC&#8221;, this allows the execution of the map to be more flexible if the invoice line item is formatted freely.  You may not be able to do this depending on your mapping technology.)</p>
<p>After the easy ones, the direct mapping ones, we get to the concatenated ones.  InvoiceID is the concatenation of the ISA_06, ISA_08, ISA_12, GS_06,  ST_02 and BIG_02.  This is straightforward as well.</p>
<p><img class="alignnone size-full wp-image-309" title="InvoiceMapping2" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/07/InvoiceMapping2.jpg" alt="InvoiceMapping2 Mapping Excersizes: EDI Invoice to Open Office Tables (part Two)" width="597" height="438" /></p>
<p><strong>Conversion</strong></p>
<p>The status will be pulled from the BIG_09 and we will want to convert this value.  Here is where the fun begins.  We may say, &#8220;Only this subset of values is accepted.&#8221;  List a set in our usage spec, and fail any that don&#8217;t comply.  Or we can try to map all of the invoices status that are in the standard to an internal status.  But this also leaves us with a possible gap if our Trading Partner doesn&#8217;t comply with the standard.<a href="http://12967i2wnvdrcfsnl1fdmv2gvr.hop.clickbank.net/" target="_top"><img class="alignright size-full" src="http://www.pdf-creator.us/images/m-softbox.jpg" width="176" height="338" title="Mapping Excersizes: EDI Invoice to Open Office Tables (part Two)" alt="m softbox Mapping Excersizes: EDI Invoice to Open Office Tables (part Two)" /></a></p>
<p>Or we can split the difference.  We map status codes that make sense to our system to their corresponding status.  And for all others, we map them to &#8220;OTHER&#8221; and note what they were into the Notes Field.  Doing this retains the data for someone to look at later.  It prevents failures on this point, and keeps the status from becoming abstracted from the original intent.</p>
<p><strong>Homework time</strong></p>
<p>Go ahead and map the other straight forward data, and document any of the transformation rules that you can.  When you are done you can check out the map that I completed up to this point.  They don&#8217;t have to be exactly the same, and only look at the example after you have given a go at doing it yourself.  Next week we will finish the mapping and talk about ways to solve some of the problems faced by the more complex and missing data.</p>
<p>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theintegrationengineer.com/mapping-excersizes-edi-invoice-to-open-office-tables-part-two/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mapping Excersizes: EDI Invoice to Open Office Tables (part One)</title>
		<link>http://www.theintegrationengineer.com/mapping-excersizes-edi-invoice-to-open-office-tables-part-one/</link>
		<comments>http://www.theintegrationengineer.com/mapping-excersizes-edi-invoice-to-open-office-tables-part-one/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 17:30:24 +0000</pubDate>
		<dc:creator>Roy</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[EDI]]></category>
		<category><![CDATA[Mapping]]></category>
		<category><![CDATA[Mapping Exercise]]></category>
		<category><![CDATA[Invoice]]></category>
		<category><![CDATA[Open Office]]></category>
		<category><![CDATA[Paper Map]]></category>
		<category><![CDATA[target]]></category>

		<guid isPermaLink="false">http://www.theintegrationengineer.com/?p=37</guid>
		<description><![CDATA[This is a mapping exercise that will go through the process of creating a paper map, or mapping document.  We will start with an empty paper map that you can get here.  And we will end with a completed paper map document that documents what data from the source goes into what fields on the [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-162" title="math" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/06/math.jpg" alt="math Mapping Excersizes: EDI Invoice to Open Office Tables (part One)" width="173" height="173" />This is a mapping exercise that will go through the process of creating a paper map, or mapping document.  We will start with an empty paper map that you can get <a href="http://www.theintegrationengineer.com/tool-box/#papermap">here</a>.  And we will end with a completed paper map document that documents what data from the source goes into what fields on the target.  This process will take more than one post, and I will link them together so that you can follow from one to the next.  Along the way, we will discuss the things that we are doing so that you can apply this technique in your mapping using the target and source in your own mapping tasks.<span id="more-37"></span></p>
<p><strong>The Target</strong></p>
<p>Open Office tables are divided into two tables. <em> Invoice</em> and <em>Invoice Details</em>.  This can be mapped in two ways; The first way is to map the data into one common format and rely on whatever ETL tool is importing the data to catch and split the data.  Second, a key can be acquired or constructed in the transformation and then the the data can be divided in to matching input formats.  Then when these inputs are moved into the database, they will relate to each other on this key.<a href="http://65e92d0uv89gefp2xcimn8dp2a.hop.clickbank.net/" target="_top"><img class="alignright size-full wp-image-116" title="ssn_databasejpeg" src="http://www.databasedesign-resource.com/images/NormalizationBook.jpg" alt="Paper Database" width="176" height="338" /></a></p>
<p>The choice of how you will do this will depend on your environment.  Questions like, &#8220;Will I have enough data to provide a unique key?&#8221;, or &#8220;is there a way to get a key with an API call or database query?&#8221;  The answers to these questions will determine what course you will take.</p>
<p>If the system ultimately receiving the data is asynchronous to the transformation, and you need to send the invoice and invoice details data separately, some care needs to be taken to ensure that the data can be related after it is separated.</p>
<p>So what data in the invoice can be used to tie the invoice to the invoice details?  The first answer might be, &#8220;The Invoice Number.&#8221;  But this number is not guaranteed to be unique across multiple vendors.  In EDI and cXML there are document unique identifiers.  Since we are using EDI, we can use a combination of the ISA Sender, Receiver, and Control number.  We will also want to use the GS control number, and ST control number in the event that more than one invoice is sent in a single <a href="http://www.theintegrationengineer.com/edi-enveloping-part-one/">envelope</a>.  And we might as well tack on the actual invoice number from the BIG_02.</p>
<p style="padding-left: 30px;"><em><strong>Database Tables</strong></em></p>
<table border="0" cellspacing="10">
<tbody>
<tr valign="top">
<td>
<p style="padding-left: 30px;">Invoice Table:</p>
</td>
<td>
<p style="padding-left: 30px;">Invoice Details Table:</p>
</td>
</tr>
<tr valign="top">
<td><img class="aligntopsize-full wp-image-54" title="Invoice Table Definition" src="http://www.theintegrationengineer.com/wp-content/uploads/2008/11/invoicetabledef.jpg" alt="invoicetabledef Mapping Excersizes: EDI Invoice to Open Office Tables (part One)" width="203" height="205" /></td>
<td><img class="aligntop size-full wp-image-55" title="Invoice Details Table Definition" src="http://www.theintegrationengineer.com/wp-content/uploads/2008/11/invoicedetailstabledef.jpg" alt="invoicedetailstabledef Mapping Excersizes: EDI Invoice to Open Office Tables (part One)" width="203" height="148" /></td>
</tr>
</tbody>
</table>
<p><strong>The Paper Map</strong></p>
<p>Now that we know what the target looks like, we fill out the target side of the paper map.  Since we will create two &#8220;files&#8221; in our output.  We are creating the Invoice and the InvoiceDetails file, but we can use one paper map for both, and will distinguish this with a bar between the two &#8220;files&#8221;.  (I am saying files, but this could be a queue, or a post, or an insert over odbc, etc)</p>
<p style="text-align: center;"><img class="size-full wp-image-181 aligncenter" title="invoiceMap_target" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/06/invoiceMap_target.png" alt="invoiceMap target Mapping Excersizes: EDI Invoice to Open Office Tables (part One)" width="281" height="435" /></p>
<p><strong>What&#8217;s Next</strong></p>
<p>Today we went through the process of identifying the target, and creating a paper map with the target format identified.  We talked about some of the strategy that we use in deciding what to map and how to map it.  Next time we will identify the source, and begin mapping data from the source.</p>
<p><strong> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.theintegrationengineer.com/mapping-excersizes-edi-invoice-to-open-office-tables-part-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mapping Exercise:  EDI to Flat file.</title>
		<link>http://www.theintegrationengineer.com/mapping-exercise-edi-to-flat-file/</link>
		<comments>http://www.theintegrationengineer.com/mapping-exercise-edi-to-flat-file/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 05:32:51 +0000</pubDate>
		<dc:creator>Roy</dc:creator>
				<category><![CDATA[Mapping Exercise]]></category>
		<category><![CDATA[EDI]]></category>
		<category><![CDATA[Flat File]]></category>
		<category><![CDATA[Invoice]]></category>
		<category><![CDATA[Mapping]]></category>
		<category><![CDATA[Mapping Excersize]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[target]]></category>

		<guid isPermaLink="false">http://www.theintegrationengineer.com/?p=34</guid>
		<description><![CDATA[Introduction: This is a quick exercise to familiarize you with mapping from an EDI file to a Flat File.  If you are new to mapping, or want an idea of what mapping EDI will be like, this exercise should be a good place to start.  If you are familiar with mapping this should be a [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-98" title="sextant" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/02/sextant.jpg" alt="sextant Mapping Exercise:  EDI to Flat file." width="119" height="117" /><strong>Introduction:</strong> This is a quick exercise to familiarize you with mapping from an EDI file to a Flat File.  If you are new to mapping, or want an idea of what mapping EDI will be like, this exercise should be a good place to start.  If you are familiar with mapping this should be a quick review with a few tips.  I use Target Based mapping.  Check out my post on Target Mapping <a href="http://www.theintegrationengineer.com/data-mapping/">here</a>.  If EDI is unfamiliar and you need some basic information, my EDI primer is <a href="http://www.theintegrationengineer.com/category/edi/the-edi-primer/">here</a>.  If you are ready to map, and understand EDI basics, then lets get started.</p>
<p><span id="more-34"></span></p>
<p><strong>Mapping:</strong></p>
<p>I practice and advocate the <a href="http://www.theintegrationengineer.com/data-mapping/">target oriented mapping</a> approach.  So we will start with defining the target.  We will do this in our 6 column spreadsheet mapping template.  This is also referred to as a Paper Map.  To download a blank template, <a href="http://www.theintegrationengineer.com/wp-content/uploads/2009/02/basepapermap.xls">click here</a>.  Once we have the target defined, we will add the source to the spreadsheet.  After both the source and the target have their fields on the Paper Map, we add the rules.  We will also need to insert some control structures to make everything flow correctly.  Once this is done we will have addressed the data format issues and constructing the map for our translator becomes just a technical exercise.</p>
<p><strong>The Flat File Target:</strong></p>
<p>What are we mapping?  This is the first question that the target defines.  In this example it is an invoice.  So we will want the following information in the following format.</p>
<p>RecordID|VendorID|DateOfInvoice|InvoiceNumber|DateOfPO|PONumber|POLineNumber|QTY|</p>
<p>~UnitCost|LineTotal|InvoiceTotal</p>
<p>Here are the parameters for these values:</p>
<p><strong>RecordID</strong>:  A unique alpha-numeric.  It is derived by contacting the ISA_Sender, ISA_Control_Number, GS_Sender, GS_Control_Number, ST_Control_Number, and Line_Number where the line number exists.  Max size of 74 characters.</p>
<p><strong>VendorID</strong>:  The ISA_Sender ID.  Alphanumeric with a max size of 15 characters.</p>
<p><strong>DateOfInvoice</strong>:  A long date, max 10 character formatted (mmddCCyy)</p>
<p><img class="alignright size-full wp-image-94" title="mappingexcersize1" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/02/mappingexcersize1.jpg" alt="mappingexcersize1 Mapping Exercise:  EDI to Flat file." width="358" height="251" /></p>
<p><strong>InvoiceNumber</strong>:  Invoice number from the Vendor, Alpha numeric, max 22 characters.</p>
<p><strong>DateOfPO</strong>:   A long date, max 10 character formatted (mmddCCyy)</p>
<p><strong>PONumber</strong>:  PO number sent on the PO.  Alphanumeric, max 22 characters.</p>
<p><strong>POLineNumber</strong>:  PO line number must be the same as the invoice line number.  AlphaNumeric, max 20 characters.</p>
<p><strong>QTY</strong>:  Quantity of items invoiced.  Numeric, max 10 characters.</p>
<p><strong>UnitCost</strong>: Cost per unit.  Currency, max 17 characters.</p>
<p><strong>LineTotal</strong>:  Total of line cost.  Currency, max 17 characters.  sum(QTY*UnitCost)</p>
<p><strong>InvoiceTotal</strong>:  Total of all line totals.  Currency, max 17 characters.  sum(all LineTotals for Invoice)</p>
<p><strong>The EDI Source:</strong></p>
<p><img class="alignleft size-full wp-image-95" title="mappingexcersize2" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/02/mappingexcersize2.jpg" alt="mappingexcersize2 Mapping Exercise:  EDI to Flat file." width="143" height="280" />We are going to get our data directly from the EDI.  We could be doing API calls to resolve VendorID values or getting an incrementing RecordID, but we can get what we need from the EDI under the right circumstances and so that is what we will do here in this example.</p>
<p>For the record ID we are going to do a simple operation and concatenate several values to create a unique value.  This will almost always be unique.  And it will refer back to the original document as a bonus.  If we wanted to ensure that it was always unique we could include data and timestamps in the concatenation.</p>
<p>For the dates, we are converting the date from the EDI format into our preferred format.  Many systems understand date format conversions, so it might be as simple as a cast or convert command on the existing string of numbers.  If not, we will have to parse out the separate values and then string them back together concatenating in with dashes.</p>
<p>And there are two values that we will need to calculate. We will calculate the value for the invoice total before we create any lines.  And we will need to create the line totals.  Since these require processing the same data, we might create all of the totals and put them in an array to easy access.  Anyway, this is the time to be creative.</p>
<p><strong>Constructing Rules:</strong></p>
<p>Now that we have the source and the target we will makes the rules, and we already have some in mind.  We know that we are concatenating the record ID, reformatting the dates, and calculating the totals.  We also add in some other rules like the trimming of the space on the <a href="http://www.theintegrationengineer.com/edi-enveloping-part-two-the-isa">ISA_06</a> to Vendor ID operation.  We will also need to do that in the record ID or it will look odd.</p>
<p><img class="aligncenter size-full wp-image-97" title="mappingexcersize31" src="http://www.theintegrationengineer.com/wp-content/uploads/2009/02/mappingexcersize31.jpg" alt="mappingexcersize31 Mapping Exercise:  EDI to Flat file." width="675" height="286" /></p>
<p><strong>Controls:</strong></p>
<p>Controls are like rules, and they may be written in the same place if we need to.  But where rules describe how we completed our mapping, controls tell us when to and not to map something.  Sometimes mapping is conditional.  Controls tell the map what conditions allow for valid mapping when conditions exist.</p>
<p>There may be times that we don&#8217;t want the map to go on and complete the process.  Obviously if we have missing data.  If there is no invoice or PO number, you may want to stop with an exception.  Generally these types of controls are easy to build as you make the target field required.  To indicate this you may want to place an additional column to indicate what data is required.  On simple projects you can just put this in the notes.</p>
<p>There will also be other times.  For instance, it might be that some invoices have their own total.  If they do not match our calculated total, we want them to fail mapping and go to manual resolution.  A use case would be to have additional charges attached to the invoice. This extra line charges would need to be handled outside of our map.</p>
<p>Controls can be written to make the mapping very powerful and provide a gateway to your data that ensures it stays valid and accurate.  Some controls go beyond stopping the map.  Instead we use them to put conditional logic into our data mapping project.</p>
<p><strong>Summary:</strong></p>
<p>This example project provided a short exercise to familiarize you with using a paper map and the fundamentals of target mapping.  In this simple example we had a target specification, and a source specification.  We created rules to move and change data from source to target, and we discussed controls.  These are the fundamental tasks of mapping.</p>
<p>But this is not the end.  I know that as I worked on this project, I saw things that might improve the map.  I didn&#8217;t include them because I wanted to keep this mapping project simple.  But you don&#8217;t have to.  You can add your own improvements to this project and make it do what you want.  I would be happy to respond to these if you post them in the comments.</p>
<p><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" id="Player_05c95da9-4dbe-4ee8-9e7f-c5da5f522b61"  WIDTH="400px" HEIGHT="150px"> <PARAM NAME="movie" VALUE="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Ftheinteengi-20%2F8010%2F05c95da9-4dbe-4ee8-9e7f-c5da5f522b61&Operation=GetDisplayTemplate"><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#FFFFFF"><PARAM NAME="allowscriptaccess" VALUE="always"><embed src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Ftheinteengi-20%2F8010%2F05c95da9-4dbe-4ee8-9e7f-c5da5f522b61&Operation=GetDisplayTemplate" id="Player_05c95da9-4dbe-4ee8-9e7f-c5da5f522b61" quality="high" bgcolor="#ffffff" name="Player_05c95da9-4dbe-4ee8-9e7f-c5da5f522b61" allowscriptaccess="always"  type="application/x-shockwave-flash" align="middle" height="150px" width="400px"></embed></OBJECT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Ftheinteengi-20%2F8010%2F05c95da9-4dbe-4ee8-9e7f-c5da5f522b61&Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT></p>
<p>You can find the resoucres for this project in the<a href="http://www.theintegrationengineer.com/tool-box"> tool box.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.theintegrationengineer.com/mapping-exercise-edi-to-flat-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
