January 29, 2007
Latin is dying
BBC News: "One of the world's foremost scholars in Latin has said he believes the language is dying out." In related news, biologists suspect bears of dumping in woods.
When I think of the decline in classics, I always remember a story my grandfather used to tell of his travels in Central Europe, I think in the 1930s. While hiking through Hungary, he ran into a fellow walker. My grandfather spoke no Hungarian, the local fellow no English. But they both spoke Latin, and apparently were able to have a good long chat as a result.
I suppose with the modern ascendancy of English, this story has become nothing more than a quaint relic, but it's always touched me as an illustration of the unifying power of the classics.
January 25, 2007
Craig Andera: "I'm going to keep calling it Avalon until no one can understand what I'm talking about."
January 19, 2007
Mapping fixed elements into a repeating structure in BizTalk
Suppose that you have to map a source schema containing a set of specialised elements to a destination schema which represents the same data as a repeating structure with a typecode.
For example, consider a source schema that's specific to restaurants, which has specialised Chef and MaitreD elements:
And a destination schema designed for generic payroll, which has a repeating Employee element with a JobTitle:
We want the Chef and MaitreD elements to map to Employee elements, each with the appropriate JobTitle. We'll also throw FavouriteCuisine and Snootiness into the Comments element.
The trick to this is to use a Table Looping functoid to build a table that corresponds to the Employee structure out of the heterogenous elements and job title constants, then use Table Extractor functoids to pull out the tabular content column by column.
Place the Table Looping functoid.
Drag a link from a "scoping node" in the source. This just has to be a node at the "right" level. In our example, the Chef node will do.
Then go into the Configure Functoid Inputs dialog and add an input with the number of columns you need in the table. In this case, the number of columns is just the number of fields under Employee, namely 4.
These two inputs, the scoping node and the column count, must be the first two inputs.
The order of the other inputs doesn't matter -- just drag links from all the fields that you want to be able to assemble into the table, plus any record nodes that contain these fields (in our case, the MaitreD node). Give these links labels -- for example label the link from the Chef/Name node ChefName -- we'll see why later.
Finally, we're going to need to use some constant strings in the table for job titles. These have to be entered as inputs to the Table Looping functoid as well, via the Configure Functoid Inputs box.
Now we can drop in the Table Extractor functoids that will pull data out of the table. In each case, the inputs are a link from the Table Looping functoid, and the 1-based column number that you're going to use in the table for the destination element, and the output is a link to the destination node. For example, if you're going to collect names in column 1 and titles in column 2, then the Table Extractor functoid that links to Name has to have 1 as its second input, and the one that links to JobTitle has to have 2 as its second input. Again you have to enter these via Configure Functoid Inputs.
You also have to drag directly from the Table Looping functoid to the repeating record element. This tells BizTalk to actually generate instances of the repeater.
When you've done this, your map looks something like this:
And your Table Looping functoid configuration looks something like this:
(Note the number of columns as the second input, and the presence of the job title constants.)
And your Table Extractor functoid configurations look something like this:
The final step is to tell the Table Looping functoid how to populate its rows and columns.
Open the Table Looping Configuration dialog (in the Table Looping Grid row of the Properties box). You'll see it's set up with four columns, corresponding to the size you specified in Configure Functoid Inputs. Because of the way we've set up our Table Extractors, we need column 1 to contain names, column 2 to contain titles, column 3 to contain salaries and column 4 to contain comments.
The key to this dialog is creating multiple rows in this dialog for the different kinds of input that we want to homogenise.
Thus, in row 1, we'll map inputs to columns as appropriate for a Chef, and in row 2, we'll map inputs to columns as appropriate for a MaitreD. We can choose both link and constant inputs, mixing them as required. In our example, column 1 is always going to be a link input from whatever/Name, but column 2 is always going to be one of the constant inputs.
In our case, the Table Looping Configuration ends up something like this:
This, by the way, is why labelling the links is important. The dialog is not resizable and the drop-down box can get quite narrow. If you don't label the links, they appear as long XPath expressions and it's a pain to figure out which one you want.