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 |
jamie
Aged Yak Warrior
542 Posts |
Posted - 2008-09-30 : 08:50:59
|
hi,do you know why this produces an error if the parameter m = 0 ?="Month : " + IIF(Parameters!m.Value=0, "All", monthname(Parameters!m.Value)) |
|
yavvie
Starting Member
46 Posts |
Posted - 2008-09-30 : 09:47:37
|
you are trying to put together varchar and integer? what error do you get? |
 |
|
jamie
Aged Yak Warrior
542 Posts |
Posted - 2008-09-30 : 10:01:05
|
hi , on the report it just says #Error in the textbox if I type 0 as the value for m. |
 |
|
jamie
Aged Yak Warrior
542 Posts |
Posted - 2008-09-30 : 10:01:58
|
Actually, in the output tab it says :[rsRuntimeErrorInExpression] The Value expression for the textbox ‘textbox12’ contains an error: Argument 'Month' is not a valid value. |
 |
|
djs
Starting Member
2 Posts |
Posted - 2008-10-08 : 12:20:39
|
Hi - this is becuase the IIF will evaluate both options but only display the appropriate one. As monthname(0) returns an error this will cause the expression to evaluate as #error.I just had the same problem and the workaround I found was to create a function to return the value. In design mode click on your report outside of the design surface and select properties-code and add a function something like:function MonthOrAll(monthnumber) as stringif month = 0 return "All"else return MonthName(monthnumber)end ifend functionthen in your report cell ="Month: + Code.MonthOrAll(Parameters!m.Value)Hope this helps! |
 |
|
djs
Starting Member
2 Posts |
Posted - 2008-10-08 : 12:21:28
|
Sorry - expression should have been="Month: " + Code.MonthOrAll(Parameters!m.Value) |
 |
|
|
|
|