Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
SQL Barbie
Starting Member
4 Posts |
Posted - 2005-01-26 : 18:05:06
|
I'm new here, so I'm not sure if this has been covered before, but I'm having a problem with a date comparison. I've got an expression in a matrix report that needs to perform a calculation based on whether a cancel date is greater than or equal to a date entered. For the life of me, I cannot get this report to recognize the > in relation to a date. Is greater than just an invalid operator within Reporting Services, or is there something (very obvious) that I'm missing?Thanks! |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-01-26 : 18:26:46
|
> is valid in RS. Please post the code.Tara |
 |
|
SQL Barbie
Starting Member
4 Posts |
Posted - 2005-01-26 : 18:35:07
|
While I know that > is a calid comparison operator in RS, I'm wondering if it's valid specifically in date comparison. When I take out the > and put = in its place, my errors go away. That's what is making me wonder if it's just not a valid operator for dates.Code is as follows:=IIF(Fields!cancel_date.Value>Fields!date_entered.Value, RunningValue(Fields!cancel_date.Value, Count, "matrix1_date_entered"), 0) / COUNT(Fields!date_entered.Value, "matrix1_date_entered") |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-01-26 : 18:42:09
|
Looks fine to me. Let's simplify it though to see what RS does. Instead of your > part, do this:=IIF(2>1, ...)Then try hard coded dates.I have this embedded code in my report that works fine with the greater than sign:Public Function DisplayMessage(ByVal startDate As Date, ByVal endDate As Date) As String DisplayMessage = "" If startDate > endDate Then DisplayMessage = "End date must be greater than or equal to start date." & vbNewLine End If End Function Tara |
 |
|
SQL Barbie
Starting Member
4 Posts |
Posted - 2005-01-27 : 16:13:05
|
Thanks for the help Tara; I got it working. Turns out the problem wasn't the > sign, it was the fact that I was missing a comma in the IIF expression. GRRRR!! |
 |
|
|
|
|
|
|