In my on-going attempts at providing a more useful lookup column using BDC, I hit a wall with the BDC picker. If you haven’t see it, the BDC picker is similar to a people picker except that it works with columns of type "business data".
You access the picker by clicking on the open book icon of a business data column as shown:
The above image shows a business data column called "Master Document Id". That column is connected, via BDC, to a web service. The web service returns two columns of information: Document ID and Title. The business purpose here is to provide a "this document is based on" ფუნქცია. Users select a "master" document and when they save, an event receiver copies meta data fields from the referenced master.
სტანდარტულად, the BDC picker looks like this when I search for a document whose ID = "38":
That’s helpful, but not good enough. People don’t think in terms of IDs, they think in terms of titles and/or other meta data. The picker allows you to search on other columns (e.g. სათაური) but won’t show the actual list of titles it found, just their DocId’s as shown here:
(The screen shot isn’t so great because I didn’t pick a search that returns any valid results, but you can see that if it had found some results, it would only have shown DocId’s, not titles).
I searched high and low for the answer to this and failed. ჩემმა კოლეგამ, the venerable Jonathan Bradshaw, had faced and solved this issue. When I reached out to him for help, he pointed me in the right direction.
Configure the picker to show multiple columns via the "ShowInPicker" property in the ADF:
<ქონების სახელი="ShowInPicker" გაცნობის="System.Boolean">ნამდვილი</ქონების>
In more detail:
<!-- სათაური -->
<TypeDescriptor TypeName="System.String" სახელი="სათაური" >
<LocalizedDisplayNames>
<LocalizedDisplayName LCID="1033">სათაური</LocalizedDisplayName>
</LocalizedDisplayNames>
<უძრავი ქონება>
<ქონების სახელი="DisplayByDefault" გაცნობის="System.Boolean">ნამდვილი</ქონების>
<ქონების სახელი="ShowInPicker" გაცნობის="System.Boolean">ნამდვილი</ქონების>
</უძრავი ქონება>
</TypeDescriptor>
Setting this property does introduce a minor problem. As soon as you set it once, you need to set it for every column you want to show. ჩემს შემთხვევაში, BDC picker showed DocId by default. თუმცა, once I added "ShowInPicker" to Title, DocId no longer displayed. I solved that by explicitly setting the ShowInPicker property for Doc ID.
Here is the result:
(I’ll explain the odd-looking "168 – CamlSchema.xsd" construction in a future blog post. In short, it’s a concatenated string that allows for a slightly better user experience).
რა თქმა უნდა, having written this blog entry, I just did a search for "ShowInPicker" and found numerous hits, including this one: http://msdn2.microsoft.com/en-us/library/ms583986.aspx. It explains the meaning of that property along with some other good BDC stuff.
</ბოლო>
გამოწერა ჩემი დღიური!