Using Altova Mapforce to Create Wikipedia Articles from an ERP backend.

So I wanted to create stub articles and useful charts to flesh out our internal wiki. I of course grabbed the amazing Altova Mapforce and made short work of generating pages and charts and then imported them into our wiki using pywikipedia

Here is what I came up with

Here is a quick flash video of the process as well.


Silly me, using the right config file for Altova Mapforce

I’ve been using mapforce for quite a long time and love it. Up until now I have always just used the default built in 00501 configurations for EDI. Well, I ran into an edi doc that needed a few additions. Well, cool I thought. I will just go in and edit the .config file, I love that flexibility! Well little did I know that if I had gone here

I could have just downloaded all of the various flavors from 3040-5030 (about 15 in total I think) and then I could have picked the right one to start out with! How’s that for ease of use!

Notice them all along the top! Oh, yeah and if you press the button that says Download additional EDI collections it will get you to the same place!

So since I’m lazy I just opened up the .mfd file with notepad and replaced the old config for the new config. I had to move around a few things but then wala I’m using that version of the config file. Nifty huh.

Convert Eif invoice to outgoing 880, quick Altova Mapforce Tutorial

Started working on converting an .eif file into an X12 880 using mapforce. One thing I learned was that when using the TransformTool.jar you can just specify a * (asterisk) for the new file name and it will use the original file name with .xml for the transformed file. Very Useful.

So my work flow goes something like this. Create a 880 svn repository. Get an .eif invoice and convert it to .xml using the TransformTool.jar (Manually for now)

Transform Explanation Doc is here

If you are curious the transform definition is

<?xml version=”1.0″?>
<!DOCTYPE InputFile SYSTEM “C:\XML\InputFile.dtd”>

Open up Mapforce and use the provided .dtd from Adage (Invoice_Outbound.dtd) and then provide it the converted .xml file (from above) to use as a reference for the mapping. (clicking the add schema/xml)

Then click the EDI button and add the 880 (under x12 tab)

Next I start studying the vendors EDI specs. I first start with ISA line, and set mapforce to match the requested Data Element Separator, Composite Separator, Repetition Separator, and Segment Terminator. I get to this by right clicking the EDI portion and then select properties. I also click the Extended button to change the Interchange Control Version Number (If needed).

Next I started creating constants and connecting them to the appropriate parts of the ISA. I just learned that Segment Terminator 85 (hex 85) equals a newline. I connect the ID qualifier and the sender/receiver ID.

Next work down to the GS. Connect a constant of GP.

Next I create my lame’o Control number generator. Basically read in two numbers, add one to it, and write out the new numbers to the same file. This is for the GS and ST segment.

I add a ‘now’ from the datetime functions and connect it to the invoice date, and then connect the document number to the invoice number (F76).

Then connect the CustomerPurchaseOrderNumber to the Purchase Order Number and PurhcaseOrderSalesOrderNumber connect to Vendor Order Number.

I connected constants for the Terms of Sale.

I met kindof a nasty snag with the date format of the InvoiceDueDate. From Adage it is output like

26-jun-2008 00:00:00

This isn’t a format that Mapforce Recognizes as a date 😦 so I had to parse out the day, month, year using a substring-before and replace combo, and then value map the jun into a 6 then connect it all to a datetime-from-parts. There might be an easier way so I posted the question on the Mapforce forum.

Next, started working on the N segments. This was interesting because I had never looked up a bill to name before in Adage. It is stored in the en_bill_tbl so did a select en_bill_name where en_bill_key = ‘whatever’

On further review all that was needed was to send the Remit to which made everything much easier. I connected a RE to the F98_1 and the rest of the name, address info etc…

Next I wanted to get looping information So I connect the Detail01 of my xml to the Loop0300 of the edi spec. Then I connected the price, quantity etc.. to the G17 etc…

To get the total invoice quantity use a sum and connect the InvoiceLineQuantity to it inside of a looping area of code.

I ran into the most annoying problem of not being able to import the generated EDI into TrustedLink. After a lot of work, thinking that it was a problem with the segment it turned out to be a slight bug in Mapforce. Inside of mapforce when I connected a now to the F337 it would truncate the time to 6 chars, but the code it was generating was truncating at 12 chars. Since that is invalid for the F337 the import was not happening successfully. To fix it you connect the now to a time-from-datetime and then to the F337 Time and the generated code truncates correctly.

Mapforce Woes

I love Altova mapforce. But every so often I run into minor blemishes. I used to be able to read in a file, modify it, and then save out to the same file. With with version 2008 rel. 2 this appears broken 😦 this is my post about it on the forum.

Now I have to map some XML to EDI and it needs a segment terminator of <CR><LF> and so far I haven’t figured out how to do it, bummer. Luckily, Altova tech support is excellent and very responsive. So I’m not very worried.

My newest mapforce tutorial

Find this post interesting? Do you like interesting things? Maybe you would like my invention, a connectible candle called a WickBrick!

Get one here


Find it here –>

I am going acronym crazy, Implementing Adage ATF files using XML

So our ERP can accept XML files. So I am trying to figure out how to get the X12 doc into the proper XML form. Luckily I have altova mapforce, and I recently just downloaded the trial of Altova XML Spy… I’ll probably end buying it as well, I wonder if they will let me take advantage of their package pricing even though I already bought a single version of Mapforce by itself? Anyways since the ERP provided a DTD (Document Type Definition) I found out that you can use XMLSpy to convert a DTD into an XSD which MapForce can use as an XML structure definition. And right now while typing I just realized that MapForce can also accept DTD file so I will just skip that step.

So now I just need to drag my EDI over to the DTD and tada the import will be complete!

Altova Mapforce is the best!