I have a DataView Webpart that displays a set of list items (articles). In each item(article) being displayed, I want to show a counter of items from another list that are linked to the unique ID of the first list. My second list consists of comments. Essentially I want to have a comment counter per article.

Thank you in advance for your answers

有帮助吗?

解决方案

It's very easy in SharePoint 2010.

You have to create a number/integer type column (say CommentCounter ) in the list (say artiLeList ) where you want to keep your article. You mentioned that you have an unique id in your articleList. So, when you create an item in the CommentList, you have to increment the CommentCounter of the artilceList with filtering by this unique id. You can do it easily by a workflow.

More detail:

  1. Create a column named CommentCounter in articleList.

  2. Open SharePoint designer and create a list workflow.

  3. Select commentList on which this workflow should be run.

  4. Create a variable say currentCC and set value, currentCC = commentCounter[articleList:id==current:id]

  5. add 1 with currentCC into a new variable say newCC.

  6. update commentCounter with the newCC.(

you can now easily show this value in your DataView WebPart.

For More information, Please query again.

Thank You.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top