Jul 262007
 

Warning, the following code is not pretty!  Often times I get into a situation where I lose my confidence in the finesse of the Biztalk Mapper.  That’s when I pull out my sledge hammer.  This is one of those occasions.

The following map wouldn ‘t work when the ST qualified or ship-to information  was not in the 1st N1 loop.  The output would always be blank.  I tried fruitlessly using every combination of looping functoid, value mapping functoid, and value mapping flattening functoid to no avail.

image

To make it work with functoids I created two “Functoid Array Strings”.  The first string (IterationString_1 in the VB.Net Scripting Functoid parameter) contains the Looping Iteration followed by a “*” followed by the N1 qualifier I was searching for.  Essentially my Iteration string would look like this – 1*CR2*IT3*ST4*IM.  I bolded the ST to show that it is found in the 3rd iteration of the loop.  Once i knew I was looking for Iteration 3 of the loop I could take in element I was looking for in the same “Iteration*Element” string format I created earlier.  As soon as I found the 3rd iteration i can just pull out the element I need and never have to worry about looping, I get the value every time.

image

Here’s the functiod logic.

Public Function ReturnSTInfo_1(ByVal IterationSTring_1 As String, ByVal N104_1 As String) As String Dim BeginningIndexValue_1 As Integer Dim EndingIndexValue_1 As Integer Dim LengthOfElement_1 As Integer BeginningIndexValue_1 = System.Convert.ToInt32(IterationSTring_1.Substring((IterationSTring_1.IndexOf("ST") - 2), 1)) EndingIndexValue_1 = BeginningIndexValue_1 + 1 If N104_1.IndexOf(System.Convert.ToString(EndingIndexValue_1) + "*") = -1 Then Return N104_1.Substring((N104_1.IndexOf(System.Convert.ToString(BeginningIndexValue_1) + "*") + 2)) Else LengthOfElement_1 = (N104_1.IndexOf(System.Convert.ToString(EndingIndexValue_1) + "*")) - (N104_1.IndexOf(System.Convert.ToString(BeginningIndexValue_1) + "*") + 2) Return N104_1.Substring((N104_1.IndexOf(System.Convert.ToString(BeginningIndexValue_1) + "*") + 2), LengthOfElement_1) End If End Function

Jul 182007
 

What are your reasons for reading my blog?

  1. You like to read about my mistakes? (I hope not)
  2. You think I am funny? (probably not)
  3. You like the color scheme of my blog? (doubtful)
  4. You have nothing else to do at work but look like you are trying to be productive? (possibly)
  5. You like to look at a lot of pictures and hate so much reading? (maybe)
  6. You actually think that some of my content has relevance to the issues you are facing? (quite possibly)
  7. You have not where else to go to get some of your BizTalk issues answered? (probably)
  8. You have an RSS feed to my site and like Pavlov’s dog, you can’t help but look at the entry that I made? (Most likely)

Wouldn’t it be great if there was one place that you could go to find all of your answers about BizTalk? If there was such a place, what would that place have on it?

Let me give you a list of the things that I have thought of (with some help, which I will talk about later).

  • Little videos off to the side of each feature of BizTalk, when I press the F1 key there is a link to a description and a video of how to use that feature. Of course that video would need to have subtitles because my Alienware does not have enough speakers (actually I don’t want to bug my co workers).
  • Links to brown bag events that have to do with BizTalk.
  • Everything would have two use cases so not only do I have an understanding of what it is I am looking for, but also how it applies in the real world.
  • More pictures (you know a picture is worth a thousand words).
  • Have the ability for me to choose the topics I am interested in, and upon arriving on the msdn home page, have a list of the pages that have changed, so I can keep abreast of the things I am interested in and what on those pages have changed.
  • More use cases, more real world examples as a note on each of the pages, ex: how can this setting make my life easier?
  • image
  • Where is the RSS feed for this page? (Shouldn’t there be one?)

I being up at the SOA conference I had a wonderful raw meat meal with some great members of the documentation team! (If you didn’t know they are great, ask some people who started learning BTS in the prerelease of 2004 and compare the help to what it is now, Webster’s dictionary of great: BizTalk documentation team!) They asked me what I would wish for in the documentation, how it could be better. These are some of the things that I wish were in there. I am a visual guy, I can’t really learn much by reading, I learn more by watching and breaking and then hopefully fixing.

 

What would you like to see in the documentation, what type of stuff would lead you to the msdn site first instead of google?

Jul 182007
 

Once upon a time there was a client that wanted to save all of the data that BizTalk dealt with into a table for further research. Now there is another client that has asked for the same request “We want to store the BizTalk XML message into a database”

Since it has come up now twice, I might as well publish to everyone how you do it.

In your orchestration, you have a long running orchestration with an atomic scope.

As a orchestration variables, you define the following:

Identifier Type
Message System.String
InputMsg {Input schema}

As a scope variables, you define the following:

Identifier Type
StringWriter System.IO.StringWriter
TempXmlData System.Xml.XmlDocument
XmlTextWriter System.Xml.XmlTextWriter

The expression shape in your scope, you have the following code:

TempXmlData=InputMsg; StringWriter=new System.IO.StringWriter(); XmlTextWriter=new System.Xml.XmlTextWriter(StringWriter); TempXmlData.WriteTo(XmlTextWriter); Message=StringWriter.ToString();

Now you have the data available to inject into your insert statement that will be sent to the data repository, along with any context data you want to send along with it.

I have received a few questions as to where the StringWriter was. I always thought that there might be a difference between Visual Studio 2003 (when I wrote this) and the later versions of Visual Studio.

I created a test solution again in BizTalk 2009 and found it. If you try to add the references and look in the System you will not find it!

According to the documentation it is in the mscorlib.dll

StringWriterReference

So if you look in the References, not in the System you will find it:

StringWriter

Jul 182007
 

In following up to this entry: restarting the Host Instance does not automatically restart the HIPAA EDI service, stomach you have to manually have to go into the services and restart this service to clear up.

I was under the impression that the Host Instance, upon restarting, will automatically restart the child services, but it does not.

Jul 032007
 

I was provided a schema with an attribute named “Type” provided by an ERP vendor.  I needed to promote it for use in Send Port Filters and in a Correlation Set.  I promoted the attribute and allowed BizTalk to create the promoted property “__Type” shown here:

image 

“Type” is a reserved name.  The Send Port Filter allows me to use this “__Type”  Promoted Property.

image

But , link . . . when I try to use this Promoted Property in a Correlation Set it gives me the following error.

image

Why does BizTalk default to the “__” prefix for reserved names, when it will not allow these prefixed names in Correlation Sets?

Jul 022007
 

In a map, I forgot to set the attribute to <empty> and therefore could not assign a value to it after the map completed.

InfoMsg.MessagePart.FileName=System.IO.Path.GetFileName(TransmissionMsg(FILE.ReceivedFileName));
InfoMsg.MessagePart.Occurrence=System.Convert.ToString(ThisInterchange);

However the error that is displayed in the ‘Service Details’ is somewhat misleading:

image

Where is the XPATH expression that does not have a node?