Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 851
  • Last Modified:

Get Current Year Syntax in Switch Statement SSRS 2005

In the following Switch statment, I have hard-coded the date 12/31/2010; however what I really need to do is have 0000 = 12/31/CurrentYear. Can someone please help me with the syntax.
Thanks,

=Switch
(   Fields!Combo_3.Value = 0001,DateAdd("D",730,Fields!Birthdate.Value),
    Fields!Combo_3.Value = 9999,"N/A",
    Fields!Combo_3.Value = 0000,CStr("12/31/2010"),
    Fields!Combo_3.Value = 0002,"Past Due",
    Fields!Combo_3.Value,Format( Mid( Fields!Combo_3.Value ,5,2 ) & "/" &
    Right( Fields!Combo_3.Value , 2 ) & "/" &
    Left( Fields!Combo_3.Value , 4 ) )  

   
   
)
0
VTFatcat1973
Asked:
VTFatcat1973
  • 3
2 Solutions
 
rockiroadsCommented:
try this

year(getdate())

or

Select datepart(year,getdate())
0
 
rockiroadsCommented:
doh!, thats just the year part

not sure if this would work though

,CStr("12/31/" + year(getdate())),

or perhap build like this

 "12/31/" + cast(year(getdate()) as varchar)
0
 
Shaun KlineLead Software EngineerCommented:
Or maybe
"12/31/" & CStr(Year(Today()))
since it looks like SSRS code, not T-SQL code.

0
 
rockiroadsCommented:
yes true lol. I missed SSRS in the title and read the zone, doh!
0
 
VTFatcat1973Author Commented:
You both were a big help. I split up the points see I kinda mislead with T-SQL as it was SSRS code. Shaun's Syntax was right on ;-) Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now