Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > Reporting Services
|
Reporting Services SQL Server Reporting Services. Please specify which version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Reporting Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2008, 11:17 PM
Authorized User
 
Join Date: Jul 2006
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help with date paramater

HI

I am trying to setup a date paramater in my report. I would like a user to be able to select a from and to date.
I have a main dataset and then another one for the date selection however when I enter a from and to date noe results are displayed.

Below iare my two data sets

Main dataset

SELECT
CASE WHEN clientcode = 'Finance' THEN 'Corporate Services'
WHEN clientcode = 'Information Management Services ' THEN 'Corporate Services'
WHEN clientcode = 'Customer Services' THEN 'Corporate Services'
WHEN clientcode = 'Committee Support Group' THEN 'Corporate Services'
WHEN clientcode = 'network Infrastructure' THEN 'Operations and services'
WHEN clientcode = 'Community Facilities' THEN 'Operationd and Services'
WHEN clientcode = 'Policy' THEN 'Strategic Planning and Policy'
WHEN clientcode = 'Legal' THEN 'Strategic Planning and Policy'
WHEN clientcode = 'Regulatory' THEN 'Regulatory'
WHEN clientcode = 'Building' THEN 'Regulatory'
WHEN clientcode = 'Communications' THEN 'Chief Executive'
WHEN clientcode = 'Human Resources'THEN 'Chief Executive'
WHEN clientcode = 'Executives' THEN 'Chief Executive' END AS Directorate,
ClientCode,
SUBSTRING(Username, 10, 12) AS Username,
SUM(CASE WHEN papersize = 'A0' THEN pages END) AS A0_total,
SUM(CASE WHEN papersize = 'A1' THEN pages END) AS A1_total,
SUM(CASE WHEN papersize = 'A2' THEN pages END) AS A2_total,
SUM(CASE WHEN papersize = 'A3' THEN pages END) AS A3_total,
SUM(CASE WHEN papersize = 'A4' THEN pages END) AS A4_total,
SUM(CASE WHEN papersize = 'A5' THEN pages END) AS A5_total,
SUM(CASE WHEN papersize = 'Legal' THEN pages END) AS Legal_total,
SUM(CASE WHEN papersize = 'DEFAULT' THEN pages END) AS Default_total,
SUM(CASE WHEN papersize = 'Letter' THEN pages END) AS Letter_total
FROM tbl_pcounterlog
WHERE (ClientCode IS NOT NULL) AND (Printer NOT LIKE '\\FDCPKUTILITY\PPUK06') AND (Printer NOT LIKE '\\FDCPKUTILITY\PPUK33 COLOUR') AND
(DatePrinted = @DateFrom) AND (DatePrinted = @DateTo)
GROUP BY ClientCode, Username

Date Dataset

SELECT DISTINCT DatePrinted AS Date
FROM tbl_pcounterlog
WHERE (NOT (ClientCode IS NULL))
ORDER BY DatePrinted

Can anyone tel me where I am going wrong?

Thanks

Greg


 
Old January 15th, 2008, 03:55 AM
Authorized User
 
Join Date: Jul 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Firstly, the way you are handling your dates is probably too restrictive:
Quote:
quote:(DatePrinted = @DateFrom) AND (DatePrinted = @DateTo)
Usually, you want a range of data between these two dates:
Quote:
quote:((DatePrinted >= @DateFrom) AND (DatePrinted <= @DateTo)
Secondly, confirm the format of your date when it is passed from the report to the stored procedure. I think the report passes the date as a string (can't be certain though), so you may need to format the date value that is passed in.

E.g.
Code:
((DatePrinted >= convert(datetime,@DateFrom,103) AND ...






Similar Threads
Thread Thread Starter Forum Replies Last Post
Paramater value cancel button errors REVNED VB How-To 1 September 2nd, 2008 01:23 PM
DateTime Typed Paramater on Parameterized Query Mutia VB.NET 2002/2003 Basics 1 July 25th, 2007 08:57 AM
ERROR: Procedure or Function 'x' expects paramater rsearing ASP.NET 2.0 Basics 7 March 3rd, 2007 07:02 AM
How to insert multiple paramater on oledbdataadpat san22 Pro VB.NET 2002/2003 1 September 19th, 2006 09:14 AM
Problems passing XPATH as a paramater to for-all bmart22 XSLT 3 January 19th, 2006 03:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.