3

I need a suggestion for a specific development requirement; it is just for a sub-site.

The sub-site has a single list with 20 columns and 850+ items. Now, in the home page, I have to have there webparts for the following purpose.

  1. have to display the recently added items (last - 5)
  2. have to display the most viewed items (top -5 )
  3. have to display the most important items (top – 5)

the list already has the required columns like item importance, view count….

I have the following ideas in my mind.

1. Custom webpart (OOB) which will do a CAML query against the list and will display the information on the webpart (3 webparts)
2. Custom webpart (SharePoint Webservice) which will do a CAML query against the list and will display the information on the webpart (3 webparts)
3. Content Editor webpart, it will call a webservice which will generate the required html code after processing the CAML query (3 webparts).

I do not want to use the CbQ webpart for some reason.

Those webparts should not take more than 2sec to load (mainly writing those webpart to improve the page performance), what is the best option? Or do you have any other suggestion?

3 Answers 3

5

If the fields are already in the list, then all three of those requirements can be handled by sorting and setting an item limit in three custom views. Why not just create a view for each one then add 3 ListView web parts on the page, each pointing to the appropriate view?

Technically, you don't even have to create the views on the list as you could just create them when defining the web part properties.

8
  • Dang, Dave beat me to it. Commented Apr 27, 2011 at 19:28
  • Ha! Now I can tell my daughter that I beat a pirate today :) That is a lot easier than trying to explain what it is I actually do!
    – Dave Wise
    Commented Apr 27, 2011 at 19:48
  • Kudos to you, we aren't easily bested! Commented Apr 27, 2011 at 20:25
  • Hmm from where do you get most viewed data? Commented Apr 27, 2011 at 20:50
  • He said all the figures were manually input into the list, meaning there is nothing to process from any log files. "the list already has the required columns like item importance, view count…." Commented Apr 27, 2011 at 20:57
3

Based on what you've said, create 3 views of this list with item limits of 5, displaying the desired data fields.

One should be sorted by created descending. One should be sorted by most viewed descending. One should be sorted by most important descending.

Add 3 list view web parts to the page, each one pointing to a specific view created above. No need for custom programming or anything, default Sharepoint functionality.

2

Where do you plan to fetch "most read" data from"?

You mention it is a list. What kind of lists are you dealing with?

In sp2007 there are no item level auditing (not implemented by design since it proved too heavy on performance) so you would have to "roll your own" data collection, for example with javascript (will only work for pages or list items, not documents).

For data collection SPQuery or SPSiteDataQuery is a good option, but consider implementing HttpRuntime cache of rendered html for performance reasons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.