Here we’ll cover creating two entities with BDC Meta Man, editing them, creating an assocation, and then generating the application defintion file.
This walkthrough is also available as a screencast that you can click here to watch
After creating our application defintion file we’ll import it into Microsoft Office SharePoint Server (MOSS) 2007, add a Business Data List and Business Data Related List web part to a page, and configure them to work together.
For this walk through we are going to use the AdventureWorks2000 sample database that is available from Microsoft here:
Generating our Application Definition File.
Open up BDC Meta Man on the PC you want to work on (it doesn’t necessarily need to be the MOSS server). To connect to SQL Server click the drop down arrow on the ‘Connect to data source’ button in the top right of the screen and choose SQL Server.
In the ‘Connect To Data Source’ box enter the name of your Server and SQL Server instance if necessary, and select the Authentication mode. If you are using SQL Authentication you will also have to enter your SQL user account details.
Upon successfully connecting to SQL Server you’ll see the top window of BDC Meta Man populate with a list of databases. You can expand each database to see the list of tables by clicking the plus sign next to each database name
Now we can see listed all the tables for this particular database. With BDC Meta Man we think of each table as being its own entity. We create an entity by dragging and dropping a table onto our design surface which is the large grey area to the right.
Upon dragging and dropping the table, the entity is created with the Finder and SpecificFinder methods. You can see a view of it on the design surface with the fields listed that are returned by the Finder method. For this walk through drag the dbo.Department table across
When you have two entities that have a primary key->foreign key relationship between them you can create this relationship as a BDC association. This will allow us to make use of the BDC Related Data web part. To add an association, drag and drop the dbo.Employee table onto our design surface to create an Employee entity. You can create an association simply by dragging and dropping between the fields that are related. With our two entities it is the DepartmentID of the Department entity, and DepartmentID of the Employee entity. Drag and drop from the Department entity DepartmentID to the Employee entity DepartmentID
Doing this drag and drop creates the association for us, and any methods required to bring data back for the BDC Related Data Web Part.
Now all we need to do is generate our application definition file. First we need to set the path to save the file. We set this location by going Configuration -> XML OutPut File from the main options. In the Filename textbox you can either manually type the location and the filename or use the browse button
Once you have saved the filename and path to create your application definition file to simply click the green play button and your application definition file will get generated.
Once generated you get the option to open the XML file in your registered XML editor. If you click yes it’ll probably open it up in Internet Explorer for you to view. Look how much XML it has generated for you!
Importing our Application Definition File.
Remember the Business Data Catalog is only part of MOSS 2007 Enterprise Edition. You can download a trial of MOSS 2007 Enterprise Edition here:
Once installed and correctly configured we need to import our application definition file.
Open up MOSS 2007 Central Administration by either browsing to it or through the start menu on the server running MOSS 2007 – Start -> All Programs -> Microsoft Office Server -> SharePoint 3.0 Central Administration.
Navigate to the Shared Service Provider Administration (SSP Admin) page from the left quick launch menu
In the SSP Admin page you’ll see a whole section devoted to the BDC. Click on ‘Import application definition’.
Use the browser button to locate our application definition file, or type in the path and filename yourself. Leave all the other options as they are for the time being, and click ‘Import’
MOSS 2007 will now go through and validate your application definition file is correct, once it is done you will get a success page. Clicking past that you will see the administration page for the BDC application we just imported
Using our BDC application in MOSS 2007
Browse to the page where you want to add the Business Data Web Part and edit the page. Click ‘Add a Web Part’ button to display the web part gallery.
Scroll down to the ‘Business Data’ section and click the checkboxes for the ‘Business Data List’ web part and the ‘Business Data Related List’ web part. Click the ‘Add’ button to add the web parts to our web part zone. Once the Web Part Gallery form disappears you’ll see the two BDC web parts added to our web part zone. Now we need to configure them. First the Business Data list, click the ‘Open the tool pane’ link to open the web part tool pane down the right hand side of the screen.
We need to select what BDC entity our BDC data list is going to display, to do this click on the Browse button.
From the pop up window select our dbo.Department Entity and click OK. Then Click OK at the bottom of the Web Part Tool Pane to configuring this web part.
Now we need to configure the BDC Related List web part. Again click on the ‘Open the tool pane’ and select the dbo.Employee entity from the Browse button as you did for the Business Data List. You’ll see when you have selected the Employee entity the relationship drop down is populated and selected with our relationship method. If our entity had multiple association methods this is where we’d select which one to use.
Click ok to close the web part tool pane. The final configuration step we need to do is to connect the web parts together so when a Department is selected, only the Employees for that department are listed. To do this click on the small edit button for the Business Data Related List web part and go:
Edit -> Connections -> Get Related Item From -> dbo.Departments
And there we go. We should now be able to bring back all the Departments by clicking on the ‘Retrieve Data’ button on our Business Data List. Upon selecting a department from the returned values the Business Data Related List will bring back the employees for the selected department.
We hope this walkthrough was useful to you. If you have any questions feel free to email them to email@example.com.