Creating a Crystal Report for Community Server
 
Published: 17 May 2006
Unedited - Community Contributed
Abstract
In this article, Eric takes you through creating a Crystal Report that summarizes unanswered questions on the forums portion of a Community Server application.
by Eric Landes
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 19283/ 38

Introduction

In the world of ASP.NET I have run across many applications based on the .NET Framework applications, such as DotNetNuke, Rainbow Portal and others.  One that I have watched since the early days was .TEXT. In recent years, the company Telligent has taken .TEXT, the ASP.NET Forums, and nGallery and combined them to create the Community Server product.  They now include an Express edition which is a free version.  There are other versions with more features that cost money. 

This product contains a blog engine, a photo gallery and a forum product.  Community Server (CS) can be utilized as a customer support option.  For this article, let us assume that is how we are utilizing CS.  We will create a forum for customer support and then we will create a report showing how many unanswered posts are in one forum.  Instructions on setting up Community Server and creating the forums are beyond the scope of this article.  Please see the community server forums for any assistance on setting CS up.

System Requirements

ASP.NET 2.0

Community Server 2.0 Express Edition

SQL Server 2000

Crystal Reports XI

Database Layout

Let us go over some of the schema information for CS.  First we will go over the naming conventions used in the CommunityServer database.  In CS, the database layout appears to follow the naming convention of prefacing each table with "cs_."  For instance, the table containing posts is named cs_posts.

Figure 1

There are a few tables without the cs_ prefix that begin with the aspnet_ prefix.

The tables our report is concerned with are the table cs_Posts and the table cs_Sections.  If we would need more data about the folks posting, then we would use tables cs_Users and aspnet_users.  Cs_Users provides the foreign key relationship from cs_Posts to user information in aspnet_users using the guid key.  Some other tables that might be useful are cs_postsrating and cs_postsarchive to see what the ranking of the posts are and any history.

The purpose of our report is to show posts that do not have responses.  The scenario for our implementation of CS is a support forum for our product.  This report should help us monitor our support forums and make sure they are providing answers to our customers.  There may be tweaks that can be made to provide more pertinent information to this report, but the purpose of this is to show the tables used in a report created for Community Server as the application.

To create the report, we first create a new stored procedure that will return the posts information, the number of replies for each post.  We also want to make sure that the post we are showing is the original post and not a reply.  To do that, in cs_posts, the threadid field can be joined in a subquery with the postid.  This builds a field that indicates if this is the original post or a reply. See code listing 1 for the stored procedure that is used to create this.

Listing 1

Create Procedure pr_get_post_thread_info
as
select cp.Subject,
      substring(cp.Body,1,250) as 'Text',
      cp.PostDate,
      (select count(*)
            from dbo.cs_Posts cp3
            where cp3.ThreadID = cp.ThreadID) as'NumberReplies',
      cp.ParentID,
      case when cp.postid = (selectmin(cp2.PostID)
                  from dbo.cs_Posts cp2
                  where cp2.ThreadID =cp.ThreadID)
                  then 1
            else 0
            end as 'IsOriginal',
      cp.PostAuthor,
      css.[Name],
      cp.ThreadID,
      cp.SectionID,
      cp.UserID
 
 
from dbo.cs_Posts cp
      inner join dbo.cs_Sections css on(css.SectionID = cp.SectionID)
 
go
grant execute on pr_get_post_thread_info topublic
go

With this stored procedure, we'll create the report to display what posts do not have replies.

Creating the report

Let us walk through the initial steps used to create this report.  Initially I used the new report Wizard.  In stepping through it for the new connection, select the OLEDB connection for SQL Server.  For this report the server name is (local) and the catalog is CommunityServer.  Once we create the connection, we can select the stored procedure.  I have included the stored procedure and crystal report on the code download file. 

To highlight the numbers that have not been answered, a chart has been created.  Below is a sample of that Chart which shows how many replies we have in each forum.  We could show the total in a different manner by stacking the totals using a bar stack format.

Figure 2

Below the chart is the grouping of the data.  It is grouped by Section and within ThreadID.  This keeps replies together (if you would like to include the replies with this report in a later version).  There is also a grouping section that includes counts of some type if necessary. 

This report also has a section parameter called SectionID.  This parameter is set to multiple values.  The record selection for the report filters by the SectionID parameter. The record selection filter also includes a filter on the NumberOfReplies.  We only want NumberOfReplies to equal 1 since that indicates that there is only one post.

Downloads

[Download Sample]

Summary

This report should keep the user apprised of how the customer service forums are solving problems.  This report can be enhanced for more details on that issue.  You should have a basic understanding of the Community Server schema for forums now and a Crystal report based on this software.  Check http://communityserver.org for more information on Community Server.



User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 



Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-05-11 2:52:35 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search