Microsoft Technology, .Net, BizTalk, Sharepoint & etc.

Liedong(Ken) Zheng, Senior SharePoint Developer at SIMPLOT

Posts Tagged ‘BDC’

Adding a Default Action to a Business Data Catalog Entity

Posted by ken zheng on May 26, 2008

 A default action is the URL, that will be used when a user clicks for details on the item (either in a BDC webpart or Enterprise Search results).  I personally discovered it because I saw an attribute in an example somewhere that had nothing to do with this topic.  First, I’ll go back and explain how to create an action to begin with.  Most BDC tools will do this for you now, but what does it actually emit in the XML?  Also of note, a lot of tools will let you create the action but not set it as a default.  Here is what typical XML looks like.  It goes in the Entity element.

<Actions>

  <Action Position=1 IsOpenedInNewWindow=false Url={0} ImageUrl=“” Name=Default>

    <ActionParameters>

      <ActionParameter Name=SiteUrl Index=0 />

    </ActionParameters>

  </Action>

</Actions>

The URL allows you to inject the value of a column similar to that of String.Format() using {0} etc.  This can be useful if you need to specify a different protocol besides http (i.e.: file://) or if you needed to construct the URL using multiple columns.  To set up a default action, you need to take a note of what you named the action (in this case I called it Default).  This is how you tell it which action to use as a default.

Now that we have recapped how to create an Action, we need to specify that its a default action.  This is actually pretty easy.  Create a new Property element in the Properties element of the Entity.  Give it an attribute of DefaultAction and specify the name of the Action we defined earlier.  Here is how it looks.

<Property Name=DefaultAction Type=System.String>Default</Property>

When you import the application definition, you will receive a warning like the following. 

 Could not create profile page for Entity MyEntity.  The error is: Default action exists for application ‘MyInstance’, entity ‘MyEntity’.  Profile page creation skipped.

This really isn’t an error.  It is just telling you that since you specified a default action, it did not automatically generate a profile page for the entity. That’s all there is to it.  Hopefully, more tools will start supporting it out of the box soon.

Posted in Sharepoint | Tagged: , | Leave a Comment »

Change BDC ADF Version Numbers

Posted by ken zheng on May 26, 2008

If you’re hand-coding ADF files and doing a lot of code/import/test cycles, use the version number to make your life easier. 

I hate to admit it, but until this week, I was always deleting the ADF and re-importing it.  This would break my business data columns and make me re-wire them.  All unnecessary.

File this under “it’s obvious once you see it”.

Example:

<LobSystem
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://schemas.microsoft.com/office/2006/03/BusinessDataCatalog BDCMetadata.xsd"
  Type="WebService"
  Version="1.2.0.0" Name="xyzzyDocumentReview"
  xmlns="http://schemas.microsoft.com/office/2006/03/BusinessDataCatalog">

Change that version and re-import and the existing business data column uses the updated version automatically with no additional configuration required.

 

Posted in Sharepoint | Tagged: , | 2 Comments »

Crawled Property mapping to Managed Property in Sharepoint

Posted by ken zheng on May 13, 2008

I have BDC and want to call search web service by filtering on certain columns on my database. The way to do is create your BDC application file includes the fields of the tables. Import to sharepoint

If your import is successful you will find the application definition file under ‘View applications’ like the illustration below.


If you click the ‘View entity’ link you will be able to review the entities that were successfully imported along with their data types.


You will then need to create a ‘Content Source’ that will crawl the Business Data. You can set up the BDC crawl for the entire BDC or a specific application.

Make sure you review the crawl log to make sure all of the data you need gets picked up. The next step in the process is to create a managed property to connect to the crawled properties you intend on searching for.

To get to the ‘Managed Properties’ window in SharePoint, you will need to access the Shared Service Provider. Once there, you should find a link to ‘Metadata property mappings’. Click this to proceed.

 

The default view is the Managed Properties. You should also notice a Crawled Properties link. The easiest way to link managed properties to crawled properties is to click the ‘New Managed Property’ link on the Metadata Property Mappings page. I like to make my property name similar to the crawled property I want to link. For the sake of this demo, I am going to add SPCN10, SPCN13, Title, CategoryName, SeriesCode, PackageCode, and ItemNumber. These are the critical fields that I am envisioning will be needed to bring back results from the Commerce Server product catalog.

To add mapping from the Crawled properties section, click ‘Add Mapping’. This brings up a screen that helps you wade through the list of content. Make sure to select ‘Business Data’ and then type in the property name. I have typed ‘Title’. It brings back the one result I am looking for. In some circumstances you may want to map one Managed Property to several Crawled Properties. I am doing just that with the SPCN10 and SPCN13 values since they are being used as an ISBN number for books in this particular schema. Make sure you remember to check the ‘Allow this property to be used in scopes’.

You need to Full Craw your Content Source before your managed properties will show.
So your search query can look like “SELECT KnowledgeEventCreatedDate  , Consultant,Title, Path, Description, Write, Rank,Size,Author,Created,CreatedBy , HitHighlightedSummary FROM SCOPE() WHERE “scope”=’Knowledge’ AND FREETEXT( DefaultProperties,’Ken’) ORDER BY Rank DESC

 

Now it’s time to set up some Search Scopes. I am going to create a search scope for Books. Search scopes can be set up in many different levels. First you have the Site Settings\Scopes, then we have Search Settings Scopes, and finally you can set them up at the site collection level.

Once your scope is created, the next step is to add rules to the item. Here is where we tie our property mappings to our scopes. I am going to select ‘Property Query’ here and then select
PackageCode. In my database I am using a package code of ‘BA’, ‘BB’ and ‘BC’ to represent books. You will need to create 3 rules to accommodate the search requirements. Don’t forget that if you want to run the scope right away to click the ‘Start update now’ under the scopes section.

From here all that is needed is to set up your Search Center with your new scope.

Posted in Sharepoint | Tagged: , , | Leave a Comment »