Monday, July 6, 2009

Retrieving data from BDC Column

Hi All,

Today we are going to discuss how to retrieve data from BDC Column. We all know that we can create BDC column once we have business application definition file installed in central administration.

If you are not clear about the BDC and about the BDC Columns, I would recommend going to this link and reading the whole series of BDC before you start reading this.

When we use this BDC Column then all fields that we have defined in FileDescriptor tag becomes available as a set in one single BDC Column. So sometimes I think, how to retrieve individual item from the single BDC Column. So here is the answer for this.

Assume that we are working with one list which has one BDC column as Order Column and it contains order information. Example ordername, order date, order qty.

Now then when you insert the list item, it will ask you for search the order based on BDC Order column which you do on Order ID. When you search and insert the record, it will fetch all the columns that you have defined in the BDC FileDescriptor tag.

To see all this in action, you create the BDC definition XML file, import and then use Business Data List web part and then play with it sometime to get to know the search field and retrieved columns.

So we have Order Date, Order Name and Order Qty as retrieved columns, then when you query the ListItems with the help of SPQuery. Let us say that we have queried on ItemId 6 by using GetItemByID method. So we will have SPListItem as objItem.

So how can we get the individual items (Order Date, OrderName and Order Qty) from one single BDC Column (i.e Order)? Here is a way to go for it.

objItem[{name of the BDC Column : {name of the propoerty}}

i.e objItem[“Order: OrderName”] //accessing with the friendly name
objItem[“Order _x003a__x0020_OrderName”] //accessing with the internal name

That’s it. Your job is done.

No comments:

Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to