views:

204

answers:

2

The software company I work for offers data conversion as a service for new clients who have previously used other similar software. I've written a VB.NET application to automate common conversion operations, and have separate logic between known vendors. A particular file layout has become rather common, but due to the nature of how this particular competitor's application stores information, certain fields mean one thing for one client, and another for a different client.

Certain elements within this vendor's format change every time, so I've written the application to account for that. Because some data fields mean different things to different vendors, I have to change my mapping code every time. This wasn't an issue when I had one of these every six months or so, but these are becoming much more common and I would much rather find a way to further automate this process.

I was thinking of implementing a simple interpreted scripting language that would allow me to save the conversion settings for the client in a text file, so I'm not having to feed the settings into my app every time I run it. My goal is to have the time spent in implementing this pay off in faster conversions in the long run.

This is the example I had in my head:

# this is a comment
RECORD INCLUDE(source[Class] != 'I' && source[Category] != 99);

FIELDMAP
  destination[name] == source[name];
  desintation[address] == source[mailingaddress1];
  ...
END FIELDMAP

BEGIN
  # logic goes here
END

I don't want to make this more complicated than it needs to be. I admit that I've never even looked into scripting and am kinda clueless as to where to start or what other considerations need to be made.

Are there already scripting libraries for .NET that will do most of what I want? Is scripting the wrong way to go about this? I really don't want to reinvent the wheel if there is a better way.

Thank you for any help. :)

+1  A: 

Rather than write a custom language, you could embed any of the DLR languages (IronPython, IronRuby, or JScript), or you can use compiler services to compile VB.NET from your application.

Another idea ... if you only need to change the mappings between variable names, maybe you could just come up with a little XML file that would define the mappings.

Jake Pearson
A DLR language sounds like what I need, but I'll explore compiler services to see if that is a viable option. Mappings are indeed part of my logic, but sometimes I need to define other logic on the fly because some fields do not map in a linear fashion. Thanks for the input. :)
Heather
+2  A: 

IronPython (one of the the DLR languages Jake referred to) is a .NET implementation of the Python scripting language. It allows you to access .NET code (including framework classes and class you've written) and would be an excellent choice for this sort of task.

It doesn't have any real dependencies (other than the .NET Framework) and you won't need to learn much learn much Python-specific syntax in order to get the job done.

(If you decide to go with IronPython, I recommend using Notepad++ as your editor.)

Josh Kodroff
I've never worked with Python before, but IronPython looks promising. I'll give it a shot. Thanks!
Heather