Important notice

Please note that this blog is discontinued here. All the posts are also coppied to my new blog at http://boris.gomiunik.net.
Important: Due to large amount of comment spam further commenting has been disabled here. If you wish to send me a comment, plase look up the same post on my new blog and leave comment there. Thanks!

2/26/2007

SharePoint list view filtered by ID

For some time now I was experimenting with the SharePoint Blog template. Did you notice, how when viewing the post under permalink you also have the related comments?

Being curious I continued to research, found that there are no web part connections. But when editing the web part current view, I've discovered a beautiful thing!

Now there is besides [Today] and [Me] that you can use for filter value, also [ID]. Perfect for making display forms and related contents. So now in new SharePoint you can filter also by ID passed in URL parameter.

Let me run that through again: First when setting up a list view, set up the filter with the following value: ID is equal to [ID]

When the list view is set, now you can use the ID parameter in the listview:

And the list view is going to display the item with that ID.

7 comments:

Jose Antonio said...

Hi Boris, I think this is a real improvement. That could make simple to relate lists between customers and accounts; activities and tasks, projects and activities, etc.
Mmmm good news for our Intranet :)

Anonymous said...

How does the Post ID get populated? This is the trick that I have been struggling with (having a Lookup that shows the values, but then populates the ID in another field)!!!

Boris Gomiunik said...

Hi craig!
Thanks for the question. The post ID field is one of the "SharePoint" fields (like created, created by, modified, modified by, etc.) that can't be tampered with and is happening on the server side. You can use the ID field in XSLT. Otherwise there is not so 100% sure solution:

create a lookup field to the same list and id field. Then using javascript refference this field zo populate another field with the dropdown length + 1.

You can use my post about using javascript to refference sharepoint form field.

http://webborg.blogspot.com/2007/07/refferencing-sharepoint-form-fields.html

The downside of this method is if you delete some posts between. For example, you enter posts 1, 2, 3, 4, 5 which get autonumbered. But if you delete posts 2 and 3 the next autonumber is 4.

Unknown said...

Hi Boris,
I have same question as Craig had. But to me the purpose is to find out how to connect a new comment( on the same view page)to the related post!!!

Boris Gomiunik said...

I've found a super post explaining the whole process. The logics apply to posts and comments as well.

http://blogs.msdn.com/sharepointdesigner/archive/2008/03/26/sharepoint-conference-building-a-sharepoint-designer-mashup-part-1.aspx

Anonymous said...

it doesn't work with the rss feed associated with the view...

Boris Gomiunik said...

Unfortunately not. This is a thing built into list view.