If you need to limit the range of values in an element in an XML schema select the element and under properties, select Restriction. An Enumeration property now appears below it. Enter the values you would like to limit your field to.
The Enumeration property is enabled in the mapping tool as well, so you can view the allowed values from there.
August 27, 2007
Restricting values in a BizTalk XML schema element
Posted by Dan Shultz at 5:35 PM 0 comments
Logical existence, IsNil, Empty String comparison
In a BizTalk Map, a logical functoid evaluating whether the field value = "" (empty string) always evaluates to true for empty nodes, even if that field doesn't exist in the source schema.
<xsi:nil="true"></>
-isNil = TRUE, Logical Existence = TRUE, Logical = [Empty String] = TRUE
<></>
-isNil = FALSE, Logical Existence = TRUE, Logical = [Empty String] = TRUE
NO ELEMENT
-isNil = FALSE, Logical Existence = FALSE, Logical = [EmptyString] = TRUE
Posted by Dan Shultz at 1:57 PM 4 comments
August 22, 2007
BizTalk Table Looping functoid scenario
Recently, I was mapping one schema to another using the BizTalk mapping tool, and I came across a transformation requirement that was a good case for using the Table Looping and Table Extracting functoids:
The source schema contained a product entity and this entity had multiple (up to 3) vendors in the product schema like:
<product>
<productId>1>/productId>
<globalVendorRelatedInfo>vendorInfo>/globalVendorRelatedInfo>
<otherProductInfo>info>/otherProductInfo>
<vendorCode1>1>/vendorCode1>
<vendorCode2>2>/vendorCode2>
<vendorCode3>3</vendorCode2>
<product>
the destination schema required that the vendors be a repeating element inside a vendors parent element. So basically the xml data needed to be normalized. Below is the mapping grid required:
The first parameter is the scoping parameter... for these purposes, I just have it hard-coded to 3, since there are 3 vendors. The second parameter specifies the number of columns per row. After that, any fields or values required must be added. Make sure to name your links, otherwise, the field parameter names will default to the unwieldy xpath query string. Drag a link from the Table Looping functoid to the target element in the destination schema.
After that, configure the columns to contain the required data. If you require that no destination record be created, select the Gating checkbox, and give the first column a boolean value. If the first column is false, no destination record will be created for that row.
Then create a Table Extracting functoid for each column and specify the Table Looping functoid, and column number.
Posted by Dan Shultz at 11:03 AM 4 comments
August 18, 2007
Text editor comparison
I was on a project recently where I found that I needed to be able to open and save extremely large (>500 MB) files, and easily preserve the formatting and line endings. After much research and testing here's what I found:
(This was on a Dell desktop w/2GB RAM)
The standard Windows editors, NotePad and WordPad were way too slow once the files were > ~200MB. Plus WordPad reformatted the document to replace individual [CR]s or [LF]s with [CR][LF]s - no matter what format type was selected.
The Visual Studio 2005 editor was very good about not reformatting the line endings... it gives an initial alert asking if you want to reformat them, then preserves them correctly when you click No. Unfortunately, this editor is also very sluggish opening large files.
You can preserve formatting also with NotePad++, and UltraEdit fairly easily, but again, when it comes to very large files they just don't cut it. My perennial favorite, PFE (Programmer's File Editor), also starts to choke once the files get large.
Finally, there's across TextPad5... It is amazing how fast it not only opens but saves gigantic text files in a matter of seconds. The only issue I have with it is that the format type reverts to the first type in the list every time, rather than the most recent choice, but IMO if you need to read/save really large text files, TextPad5 is so much faster than anything else, that it is easily the way to go. Special thanks to Matt Casto for recommending it.
Posted by Dan Shultz at 12:05 AM 1 comments
August 08, 2007
BizTalk replace functoid trick
Here's a neat trick I stumbled on in the BizTalk 2006 mapping tool:
If you need to change a functoid that has many links associated with it, instead of deleting the functoid and creating a new one and re-adding all the links, you can just drop the new functoid on the old functoid in the grid. All links and parameters are preserved, just the functoid changes. Here's an example:
Say you want to change the Not Equal functoid to an Equal functoid
Dropping the Equal functoid changes the functoid type, but preserves the links and parameters.
I even tried replacing a functoid with another functoid requiring limited parameters and it still preserves everything even if there are illegal parameters.
Posted by Dan Shultz at 4:21 PM 0 comments