Creating Custom Reports for DotNetNuke using Crystal Reports - Part 2
page 3 of 6
by Eric Landes
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 26892/ 49

Creating a Summary report for Forums

We' wil begin by creating a Summary report for the Forums.

Listing 1

create view vwforums_ForumSummarry
as
select distinct fp.[Subject]
      , substring(fp.[Body],1,4000) as 'Body'
      , ff.[Name] as 'Forum'
      , ft.replies + 1 as 'TotalThreads'
      , ft.replies
      , us.Username
      , us.FirstName
      , us.LastName
      , ft.threadid
      , fp.postid
      , (select fp1.subject
            from Forum_Posts fp1
            where fp1.postid = (select min(fp2.postid)
                                                from Forum_Posts fp2
                                                where fp2.threadid = fp.threadid)
            ) as 'FirstSubject' 
from dbo.Forum_Posts fp
 inner join dbo.Forum_Threads ft on (ft.threadid = fp.ThreadID)
 inner join dbo.Forum_Forums ff on (ff.ForumID = ft.ForumID)
 inner join dbo.Users us on (us.UserID = fp.UserID)

We have changed this query from the original in Part 1.  We have added the threadID and the postID to allow us to do appropriate ordering and grouping for the report. We also now have a subquery that returns the first subject from the table. This way, in our report we will have the first subject without the RE: in the name.

We also made this into a View. That way, when we need to add any fields or tables, we can change the view. In Crystal, using the field explorer window and selecting the database object, you can use Verify Database to automatically update the fields. This makes changing management for the data source much easier to handle than using updating the data source.


View Entire Article

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-04-24 1:32:59 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search