How to add new reports in DNN Site Log?
This is a beginner level post and the purpose is to introduce you how SiteLog is organized and add a new report in Site Log.
First, we'll look at how Site Log works and then introduce a new report. At the core of Site Log there are two tables,
Lists (Table)
Lists table is used throughout DNN for a number of purposes. This table contains types of reports available in SiteLog type drop down. With a default DNN installation 12 reports are avaialble filtered by the field ListName as following,
SELECT *
FROM {databaseOwner}{objectQualifier}Lists where ListName = 'Site Log Reports'
The resultant shows that each record is assigned a unique value (identified by Value field) from 1 - 12.
SiteLog (Table)Thi s table contains data for site log which is used by the stored procedure to render.
GetSiteLog (Stored Procedure/s)
GetSiteLog referres to a series of stored procedures each affixed by a number denoting which report it belongs to. For example SiteLog5 referrs to the Lists table record identified by Value field equal to 5 which is 'Page Views By Hour'.
How to add a new report in SiteLog
Step 1: To add a new report type, simply add a new record in Lists table providing it a new unique value. Please make sure that value is unqiue. Based over this unique value, the respective report stored procedure is called as we shall see.
Here I'll add a new report as existing report 'Page Views By Day' but that will list views by annonymous users only,
/* insert into the list of reports */
INSERT INTO {databaseOwner}[{objectQualifier}Lists]
([ListName]
,[Value]
,[Text]
,[ParentID]
,[Level]
,[SortOrder]
,[DefinitionID]
,[Description]
,[PortalId]
,SystemList)
VALUES
('Site Log Reports'
,13
,'Anonymous Page Views By Day'
,0
,0
,0
,-1
,NULL
,-1
,1)
GO
So now our site log drop down will have a new report listed. However clicking on this report will report an error that GetSiteLog13 doesn't exiss so we need to create one.
Step 2: Create the stored procedure that outputs tabular data required to be rendered. Since we are only tweaking the 'Page Views By Day' data, we can simply use the existing stored proecredure GetSiteLog1 and change it a bit.
Here's how our new SP look like after changing,
/*This SP will return page views by day for annonymous users only.*/
CREATE procedure {databaseOwner}[{objectQualifier}GetSiteLog13]
@PortalID int,@PortalAlias nvarchar(50),
@StartDate datetime,
@EndDate datetimeasselect datepart(weekday,DateTime) AS 'WeekDay',
count(*) AS 'Views',
count(distinct {objectQualifier}SiteLog.UserHostAddress) AS 'Visitors',
count(distinct {objectQualifier}SiteLog.UserId) AS 'Users'
from dbo.SiteLog
where PortalId = @PortalID and UserId IS NULL
and {objectQualifier}SiteLog.DateTime between @StartDate and @EndDate
group by datepart(weekday,DateTime)
order by WeekDay
About Me
Usman ur Rehman Ahmedis known as a software engineer in Lahore, Pakistan. He is renowned for having an abstract understanding of vast range of technological developments such as programming languages, web development, RIA's and documental writing, and is mainly specialized in developmental analysis.
Tags
- windows phone 7 (15)
- DNN (14)
- Dot Net Nuke (13)
- .NET (5)
- c# (5)
- manifest (4)
- Application (3)
- MySql (3)
- Provider (3)
- Sql (3)
- View all 237 tags »
- Sql Server (3)
- Stored Procedure (3)
- visual sutdio (3)
- API (2)
- Data (2)
- Mango (2)
- Module (2)
- Permission (2)
- PhoneTextBlock (2)
- User Control (2)
- Windows (2)
- config (2)
- console (2)
- developer (2)
- dot net (2)
- emulator (2)
- enumeration (2)
- expression blend (2)
- extension (2)
- loop (2)
- network (2)
- phone 7 (2)
- tools (2)
- transparent (2)
- .ascx (1)
- 3g (1)
- 5.6.2 (1)
- 7.1 (1)
- 7.5 (1)
- AJAX (1)
- Activity (1)
- App.xaml (1)
- AppManifest (1)
- ApplicationIcon (1)
- Arabic (1)
- Background.png (1)
- BuildAction (1)
- Connector (1)
- Control Panel (1)
- Core Version (1)
- Data-tier (1)
- DataBound (1)
- Database (1)
- Dependency (1)
- DeviceNetworkInterface (1)
- Directory (1)
- Dynamic (1)
- EVDO (1)
- Encryption (1)
- File (1)
- FileSystemWatcher (1)
- Filter (1)
- Foreign Key (1)
- Function (1)
- GUID (1)
- GetSiteLog (1)
- Hash (1)
- Host Settings (1)
- IIS6 (1)
- IIS7 (1)
- Integrated Mode (1)
- Internet Explorer (1)
- IsolatedStorage (1)
- Java (1)
- Koder (1)
- Linq (1)
- Lists (1)
- Log (1)
- Marketplace (1)
- Membership (1)
- Microsoft (1)
- NavigationCacheMode (1)
- NavigationContext (1)
- NavigationService (1)
- Notify (1)
- OnClientNodeChecked (1)
- PTCL (1)
- Panaroma (1)
- Password (1)
- Properties (1)
- Query String (1)
- ResXResourceReader (1)
- ResolveHostNameAsync (1)
- Right to Left (1)
- SDK (1)
- SEO (1)
- SendKeys (1)
- SendWait (1)
- SharpPCap (1)
- Stream (1)

