Project Description
This is a tool I wrote to help me migrate data from Domino databases into Infopath documents hosted on a Sharepoint Form Library.
The tool takes a CSV source file and creates a new Infopath document for each record. The user is presented with an interface to map fields between the CSV source and the Infopath nodes.
I created the tool to migrate Domino data, but any CSV file should work fine.
For more information about this project, see my blog: http://akennel.blogspot.com


Previous versions of this application can be found here: http://code.msdn.microsoft.com/CSVtoInfopathTool

This is a migration tool for CSV to Infopath data. The tool allows you to take data in a CSV file and, for each line in the CSV file create a new Infopath file. The structure of the Infopath file is based on an example file that you create prior to running the tool.

I created the tool with a Domino to Infopath migration in mind, and that is how I am testing. That said, any CSV data source should work just fine.

Requirements:
This application was written for migrating a standard CSV formatted file into an Infopath 2007 XML document.
You will need to have your source CSV file, and an example Infopath document. This is a C# application written on the .Net framework.

Installation:
No installation necessary. Just run MigrationTool.exe.

Configuring the files:

CSV Source File:
Any CSV data file should work. I built this tool to help me migrate data from Domino databases, so that is the type of CSV file I've tested on.
Here is how to export data from a Domino database. Begin by creating a new view in your database. This view should have a column for each field that you want to export. Only fields that appear in a column of your export view will be exported, so be sure you get everything. You'll want to name the columns with unique names that are easy to identify.
When you are happy with your Export View, open this view in your Lotus Notes Client. Click File...Export. Give your export file a name, eg: export.csv. Change the "Save as Type" option to "Comma Seperated Value" and click Export.
On the CSV Export window, select the "All Documents" and "Default character set" options. Also, be sure to check the "Include View Titles" option. Click OK and your database will be exported.

Infopath Example File:
The MigrationTool needs a blank Infopath file to read the XML structure from. Begin by creating your Infopath form, and associating it with your Sharepoint Form Library. (Be sure to name your fields descriptively, so they are easy to identify) From the Form Library use your new Infopath template to create a new document. Save a copy of this file on your computer.
This file will be your template. I recommend opening the file with Notepad. Any field that has a value will retain that value unless the CSV has a matching entry.
-- This is very important-- If your Infopath has a value in one of its fields, and that field is not mapped to a CSV field, every newly created Infopath document will retain that original value. This makes it very easy to set something like "Migration Date" field and have that field be populated on every document. It also makes it very easy to have unwanted field entries. I highly recommend you manually remove any field values that you do not want. Be sure to leave the tags.
For Example, here's a very simple Infopath file:
<?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution...Blah, blah, blah>
<my:Application>"I'm an application!"</my:Application>
<my:DatabaseName>"I'm a database!"</my:DatabaseName>
<my:ImportDate></my:ImportDate>
</my:myFields>
In this file, I'd want to remove the field values for Application and DatabaseName. That way I don't have to worry about accidentally setting all my documents with the same value. I'll set the ImportDate field to today's date, so all my new documents would have that date set. I'll just need to remember not to map a field to ImportDate. My new document would look like this:
<?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution...Blah, blah, blah>
<my:Application></my:Application>
<my:DatabaseName></my:DatabaseName>
<my:ImportDate>"3-12-2008"</my:ImportDate>
</my:myFields>

Limitations:
The first big limitation is that this tool can't handle file attachments. No big surprise there, since CSV can't do file attachments either.
All field mappings need to be done manually. I give you an interface to match the fields, but if your document has lots of fields, this step is going to be time consuming.
No data transforms. If you have a date and time squeezed into one field, and want to seperate them into two seperate fields...sorry can't do it. If you have a radio button on your Infopath form but radio boxes on the Domino form...you're going to have trouble. You get the picture.

Repeating fields in Infopath are somewhat supported. On your example XML file, create as many repeating fields as you want to populate. The repeated fields will be disignated as -1, -2, -3, etc. Each must be mapped to a corresponding CSV field.

Last edited Apr 11, 2008 at 7:13 PM by akennel, version 3