Wednesday, August 6, 2008

BizTalk Get Common Value, Get Application Value Functoids

You don't hear much about the "Get" or "Set" database functoids in the BizTalk mapper. Eric and Tom have blogged on these (and most likely a bit more in-depth).

These functoids are actually quite useful. For example the "Get Common Value" and "Get Application Value" functoids which I'm currently using.



Scenario - I have a trading partner that sends in an EDI document (850 purchase order request). The unit of measurement list in the X12 standards are two characters long. They don't exactly match up with the system I'm trying to send to (PeopleSoft) - some can be three characters. So I'm thinking "a database lookup table will work perfect for this."

I could do one of two things: a custom database table or use the BizTalk-supplied functionality using the xref_ tables supplied in the BizTalkMgmtDb. In fact, this is exactly what the BizTalk developers had in mind for this, I think. :)

At any rate, for simple lookups, 3 tables are used: xref_AppType, xref_ValueXRef, and xref_ValueXRefData. The relationship is fairly straightforward.


The above screenshot essentially describes the "Get Common Value" in SQL terms. The parameters are in the same order as the functoid expects (the 'Value' most likely the input to the functoid, which would be the 3rd parameter). With the "Get Application Value" functoid, the commonValue field and appValue are effectively switched/reversed, essentially making it a "select appValue where commonValue = xxx".

There is a BizTalk utility (BTSXRefImport.exe) to load the data in, but in this case I decided to load the data in directly via SQL Server (guilty as charged - I like working directly with databases).

Hope this helps clarify what these two functoids can do.