Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsReportsReportsNice report but something is missingNice report but something is missing
Previous
 
Next
New Post
7/17/2006 4:43 PM
 

I have a nice report that shows me a list of subscribers sorted on expiry date but I also want the 'CreateDate' of that those accounts listed. I have no idea how I can innerjoin the aspnet_Users table and the CreateDate in my report....

SELECT DISTINCT(UR.UserID), U.FirstName, U.LastName, R.RoleName, ExpiryDate
FROM USERROLES UR
INNER JOIN USERS U ON UR.UserID = U.UserID
INNER JOIN ROLES R ON UR.RoleID = R.RoleID
WHERE UR.ExpiryDate IS NOT NULL
ORDER BY ExpiryDate  

 
New Post
7/17/2006 4:58 PM
 

How about join two other asp_ tables like below

 

SELECT DISTINCT TOP 100 PERCENT UR.UserID, U.FirstName, U.LastName, R.RoleName, UR.ExpiryDate, dbo.aspnet_Membership.CreateDate
FROM         dbo.aspnet_Membership INNER JOIN
                      dbo.aspnet_Users ON dbo.aspnet_Membership.UserId = dbo.aspnet_Users.UserId INNER JOIN
                      dbo.UserRoles AS UR INNER JOIN
                      dbo.Users AS U ON UR.UserID = U.UserID INNER JOIN
                      dbo.Roles AS R ON UR.RoleID = R.RoleID ON dbo.aspnet_Users.UserName = U.Username
ORDER BY UR.ExpiryDate


Fuji Nguyen
FREE Visitor Hit Counter
Visit opensource.indyneinc.com for detail.
 
New Post
7/17/2006 5:07 PM
 
The CreateDate is stored in aspnet_Membership, so in order to access it you need to first JOIN to the aspnet_Users table using the "UserName" field and then join from there to the aspnet_Membership table in order to retrieve the CreateDate:

SELECT DISTINCT(UR.UserID), U.FirstName, U.LastName, R.RoleName, ExpiryDate, AM.CreateDate
FROM USERROLES UR
INNER JOIN USERS U ON UR.UserID = U.UserID
INNER JOIN ROLES R ON UR.RoleID = R.RoleID
INNER JOIN aspnet_Users AU ON AU.UserName = U.Username
INNER JOIN aspnet_Membership AM ON AM.UserId = AU.UserId
WHERE UR.ExpiryDate IS NOT NULL
ORDER BY ExpiryDate  

However this brings up a bug in the way the reports module filters out SQL scripts that could cause damage to the database. Originally, any administrator could create queries, and if they were to use on of the SQL Commands that changes the database (such as INSERT, or DELETE, or CREATE) they could seriously damage the database. To prevent this, the module filters out these SQL commands, and unfortunatly will filter out the 'Create' in 'CreateDate'. Since in the current version, only SuperUsers can create reports, this filter is not necessary anymore and it has been removed for the next release

So, to cut a long story short, what you want to do is not really possible at the moment because of a limitation in the module that has been fixed for the next release. The SQL above should return the data you want, but the Reports module will remove the word 'Create' from 'CreateDate' (confusing it with the SQL Command: CREATE) which will cause an error in the Report.

Andrew Nurse
DotNetNuke Core Team Member and Reports Module Project Lead
Microsoft Certified Professional Developer

 
New Post
7/17/2006 5:07 PM
 
Yes, that was the way it should be. When I ran this in Management Studio or Host SQL it works but in the Reports Module it returns "The report query returned no results". Any idea why that happens?
 
New Post
7/17/2006 5:11 PM
 
Andrew, is there a workaround? I could get rid of Create in FormatRemoveSQL?
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsReportsReportsNice report but something is missingNice report but something is missing


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out