Updating data through the BDC

The Business Data Catalog (BDC) is one of the best features of MOSS 2007 (no, it's not in WSS 3.0). What excites me is the prospect of not only reading from, but writing back to data sources defined in the BDC. It's recently come up a few times and I've found that many people believe that updating source data is simply not possible, so I second-guessed myself and went back for a closer look to clarify the reality.

The goal is to create, update, and delete data in addition to retrieving collections, single items and enumerators. There are two ways to do it, and both aren’t quite ends in themselves though only a little extra work is required for deletes.

The first method is to treat the BDC source simply as a data reader, and to build your create/update/delete logic in an assembly. The BDC object model provides the means to retrieve collections, list items and enumerators, and you do the rest. You get the Web Parts to display data, but you still need to roll your own forms inside web parts to create and update.

The other way is with Actions. Think of an action as simply a Link which appears beside each BDC item. In constructing the link, you can inject parameters from the selected BDC row. So the easiest here is Delete, though even that requires building a page that invokes the Delete method and then redirects back to the calling page (assuming the reload will show the revised list). Create and Update still require a form to edit content, and you could launch such a form from an Action. Again the BDC isn’t the end in itself. Additional benefit is that Actions are displayed in BDC Web Parts. They’re great for things like +1, -1, Map this location, Go buy this book, or Go see this product’s web page.

A third way that I don't consider "SharePoint" though it is "Office" is to create an Action which opens an InfoPath form to edit a BDC object. It’s the recommended solution. It requires InfoPath. It does work. Coming from a web background, I want SharePoint to be my web platform so requiring any application besides a browser seems klunky to me.

Before today, I thought there way another way but it turns out it doesn’t have all the pieces to work. You specify a data source's methods in the BDC’s configuration. The standard types are Finder, SpecificFinder, and IDEnumerator, and additional methods can be defined with the GenericInvoker type. I thought you could plug parameters into a GenericInvoker to run ops on a specific item, but its parameters aren't row-specific. So, it’s fine for invoking simple methods on the source, launching processes, and perhaps to lookup lists of available choices for a particular field, but doesn’t mean much for creating or updating new records.

So yes, you can specify methods that update a data source from a BDC configuration file, but they don’t automatically give you consistent ways for a user to create or update records. The easiest way to make forms to update items in BDC data sources is with InfoPath. Back to the Studio.

And then there's LOBi, for "Line-of-business Integration." This is the successor to the Information Bridge Framework (IBF). My understanding was that LOBi builds on the BDC, and then a product like Duet builds on LOBi for a specific data source. In Duet's case that source is SAP. The LOBi document linked above seems to dispute this and positions LOBi as a read-write alternative to the BDC. So maybe it was originally explained to me by someone in sales or marketing, for whom "builds on" means "it costs more and does more" rather than "y uses x as its underlying technology." Either way, LOBi would seem to solve the issue, if only there were a download, documentation, sample code, and a web part or two to refer to. Alas, back to custom code or InfoPath. And Studio.

Until next time,

No Comments