Pergunta

I have a web part page in a document library (http://mysitecoll.com/subsite1/Cust001/cust001.aspx)

  1. I have added web part to display list from the top level.
  2. It works and displays all the items in a list.
  3. However, I only need to display items where customerNumber = documentLibrary so in this example, it will be (customer number = cust001) or whatever the the current document library user is in.

Hope it makes sense.

The list should only display items where customer number = current document library name

=================== additional details added =====================

Lori, Here are the details

  1. Top site has a list "Customer List" containing customer's Name, address, telephone, etc.

  2. Every customers has it's own document library under http://url/siteCollection/CustomerWeb/

  3. I need to add a web part pages for each of these document libraries (programatically) (document library for customer 222 looks like this http://url/siteColl/custWeb/customer222)

  4. The web part page that I need to add to document library will have 2 web parts. a. First webpart displays the list from the top site (customer list) but I need to filter it so only customer in question is showing. for example, I am in Ann's Fashion document library and customer number of this client is 222 so their document library name is "Customer222". Column in Customer List "customer number" should be same as document library title or name as thats the only match.

I hope it's clear now.

Foi útil?

Solução

Are all of your libraries for different customers? Are you actually trying to display a different library or list depending on the user? Or are you saying you will be adding this web part to all of the .aspx pages of the library views so that a the list will filter by the library? I'm a little confused as to whether you want the library to change based on the customer or the list to change and you will put it on each library page.

Thanks for your updates. I would add a filter to the page using 2 things. 1 would be a javascript or jquery in a CEWP that will parse the customer number from the URL, you could probably use substringbefore and substringafter to get that, then put that value into a text filter on the page. You can then apply this filter to the list web part on your page.

Another option that might be easier is to convert the list web part to an XSLT data view and then go into SharePoint Designer and create a parameter that will be the substring and apply that filter automatically.

The first option will give the ability for the user to change the filter if needed, the second will not.

Outras dicas

  1. http://msdn.microsoft.com/en-us/library/dd583143(office.11).aspx

  2. Add these two line

<xsl:variable name="DocLibName" select="substring-before(substring-after($PageUrl, '/Forms/'), '/')" />

<xsl:param name="PageUrl"/>

  1. set VIEWFLAG=1 (it should be in the properties windows)

  2. Find this line and modify if you want Filter the webpart list

<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />

Change it to following

<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[(@customerNumber=$DocLibName)]"/>

You can use this to display

<xsl:value-of select="$DocLibName"> <br/>

<xsl:value-of select="$PageUrl"/><br/>

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top