Eric’s BizTalk 2004/2006 Blog

My BizTalk Experiences using Flat Files, InfoPath, BAM, BRE, BAS, HL7, HIPAA, WSS.

February 23, 2006

Adding functionality to the Expression Editor

Filed under: BizTalk — eric @ 7:56 am

For those of you who like to manipulate data in the expression editor, there are a few things that can be done:
1. You can build a C# or VB.NET assembly that will take a string and manipulate it returning the correctly formatted string
2. You can use xpath.

A clients request is that we parse from the filename, the date that is embedded in the filename.

The first thing I did was extract the filename into a variable called FileName:
FileName=IncomingMsg(File.ReceivedFileName);
FileName=System.IO.Path.GetFileName(FileName);

Then I needed to pull from position 26-31 the date into the variable MessageDate:
MessageDate=xpath(”substring(’”+FileName+”‘,26,8)”);
(One gotcha is that you have to put a single quote ‘ right after the open paranthese and then a double quote ” and then concatonate the variable and then do the reverse to close it out. The other gotcha is that if you are parsing out a string that has a single tick ( ‘ ), you will have to use the Regex replace and replace it with another variable, substring the variable, and then replace the single tick back.)

This adds quite a bit more functionality to the Expression Editor than what is currently available.

The web page that I use as a xpath reference is this page.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.