开发者

SharePoint 2007 Dynamic Filtered Lookup

Good morning, all. I'm looking for help with setting up a library template in SharePoint 2007. Here are the details:

  • I have a parent site with several subsites.

  • I want to set up a library template that can then be placed on each subsite. These libraries are going to pull from a series of centralized lists on the parent site in order to provide metadata options. This way, I only have to maintain one set of lists and the maintained list information will be available to each library.

  • Because the libraries exist on subsites of the main site, I can't use simple lookups. A regular lookup column type only works for lists within the current site.

  • I have access to the filtered lookup column type, and it seems like the right choice because it allows me access to the centralized lists on the parent site.

I'm looking to hav开发者_Python百科e the user prompted when uploading files to a library based on this template. After selecting the file, the user is presented with the list of metadata choices to fill out.

  • I want to have the first filtered lookup provide the user with a list of choices. This currently works properly.

  • I want the second filtered lookup to provide a filtered list of choices based on the selection in the first filtered lookup.

  • There's a section for a CAML query filter string, and this is where my hangup is. How does one write a string to reference a field as opposed to a static value?

This is what I've tried. In the Apply Query Filter field, I have put:

<Where>
  <Eq>
    <FieldRef Name='Category' /><Value Type='Lookup'>Blue</Value>
  </Eq>
</Where>

This works, but only provides results where the value is Blue, a static string. I'm looking for a way to reference the actual selected value of Category. It would be something to the effect of:

<Where>
  <Eq>
    <FieldRef Name='Category' /><Value Type='Lookup'>[Category.Value]</Value>
  </Eq>
</Where>

My hangup right now is I don't know the proper syntax, or if such syntax even exists.

Many thanks for your suggestions. I'm not tied to this approach, so if there's another way to accomplish the same goal, I'll be happy to entertain it.


This is an old question, but I just now stumbled upon it - In case the user still needed help, I figured I'd answer. You can do this 2 ways: 1. Callback 2. Querystring

Either way will work fine and will provide the data to your query. The trick is to add a lookup parameter, something like:

<ParameterBinding Name="Category" Location="Control(Filter1)" DefaultValue=""/>

or

<ParameterBinding Name="Category" Location="QueryString(Filter1)" DefaultValue=""/>

You can then reference the variable in your CAML query the SPDataSource selectcommand:

<Where>
<Eq>
    <FieldRef Name='Category' /><Value Type='Lookup'>{Category}</Value>
  </Eq>
</Where>

The variable name above of {Category} is the name provided by the ParameterBinding.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜