Groups | Blog | Home
all groups > sql server reporting services > july 2007 >

sql server reporting services : Parameter Question


John Wright
7/19/2007 2:45:56 PM
I have one report that contains three matrix controls. The first matrix is
filled with data for the current month (June of 07 for example). I have a
parameter dropdown listed with the months to select. The second matrix
report is the year to date total which is all data up to the previous month.
So if I put in the date of 6/1/07 I get all the data in matrix 1 for the
current month, now I want to fill the second matrix with the data up to
5/1/07 (or one month less that the data for grid 1). I have a parameter set
up that is set to a list of all months to report on. How can I
automatically set the parameter for the second matrix to be less one month
of the parameter selected? I am reporting against an Access 2000 database
(not by choice.)


John

Michael C
7/19/2007 3:08:02 PM

John,
Does your parameter list look like

A:
Jan
Feb
March
April
....

or

B:
1
2
3
4
....

???

is the data in the field you are querying a month Name or a Number?

Michael

[quoted text, click to view]
John Wright
7/19/2007 4:04:24 PM
How can I check for an NaN when doing math functions? Isn't this the same a
divide by zero?

John
[quoted text, click to view]

mischa
7/20/2007 12:38:01 AM
Hi John,

not sure if I understand you 100% but to summarize how I understand your
question you want the 2nd control to follow the lead of the 1st control so to
speak.

Hmm... I've done this myself but I wonder if this is not too difficult. I
assume that the field underlying the first control is an actual date/time
field. The trick was for me get the dates right for the selection on the 2nd
control. For example if you select June in the first control you will need
all the data until the 31st of May in the second... of course each month has
a different number of days.... I solved in the following (cumbersome?!?) way:

I created a 'from' and a 'to' parameter...

FROM:

=datevalue(Month(Fields!StartDate.Value)&"/01"&"/"&Year(Fields!StartDate.Value))


TO:
=datevalue(month(Fields!StartDate.Value)&"/"&IIF(month(Fields!StartDate.Value)=1,31,
IIF(month(Fields!StartDate.Value)=2,28,
IIF(month(Fields!StartDate.Value)=3,31,
IIF(month(Fields!StartDate.Value)=4,30,
IIF(month(Fields!StartDate.Value)=5,31,
IIF(month(Fields!StartDate.Value)=6,30,IIF(month(Fields!StartDate.Value)=7,31,IIF(month(Fields!StartDate.Value)=8,31,IIF(month(Fields!StartDate.Value)=9,30,IIF(month(Fields!StartDate.Value)=10,31,IIF(month(Fields!StartDate.Value)=11,30,31)))))))))))&"/"&year(Fields!StartDate.Value))


You will need to replace the parts 'Fields!StartDate.Value' with something
like
'Parameters!Date_Parameter.Value' because your second control is triggered
by the first (I did this as a navigation to another report)... It may look
difficult, but it really isn't... not saying this is the easiest way because
I'm only a noob with this stuff (lots of Access experience, only about a
month in Visual Studio)

hope it helps!
mischa

[quoted text, click to view]
John Wright
7/20/2007 7:48:55 AM
I found a way to do this quite easily. In the query for the second dataset
I used the following

WHERE Period <= DATEADD(MONTH, -1, ?)

Since OleDB can't process named parameters you have to use the question mark
then associate the parameter a report parameter. I associated the parameter
from matrix 1 to this dataset and it gives me the date -1 month.

John
[quoted text, click to view]

AddThis Social Bookmark Button