Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

IIF or SWITCH Condition to use and how Expand / Collapse
Author
Message
Posted Thursday, September 27, 2012 12:46 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, September 27, 2012 12:37 AM
Points: 1, Visits: 0
Hi,

I have a report where countrycode is a paramater and i need to show the date format as dd/MM/yyyy on basis of countrycode. Can someone help me know how can i simplify the statetment for the condition?
In Pseudo code:
If countrycode in ("AU", "NZ", "IN", "MAL")
then
endDate.Format("dd/MM/yyyy")
else
endDate.Format("MM/dd/yyyy")
end if

I need to write somewhat the same for my report (.rdl) file.

Thanks
Susheel
Post #1365054
Posted Friday, September 28, 2012 5:58 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 12:03 PM
Points: 782, Visits: 730
sanju2t (9/27/2012)
Hi,

I have a report where countrycode is a paramater and i need to show the date format as dd/MM/yyyy on basis of countrycode. Can someone help me know how can i simplify the statetment for the condition?
In Pseudo code:
If countrycode in ("AU", "NZ", "IN", "MAL")
then
endDate.Format("dd/MM/yyyy")
else
endDate.Format("MM/dd/yyyy")
end if

I need to write somewhat the same for my report (.rdl) file.

Thanks
Susheel


a case statement is your friend
case when countrycode in ("AU", "NZ", "IN", "MAL") then convert(varchar(12),[datecolumn],101)
else convert(varchar(12),[datecolumn],103)
end

*code may take some tweaking
Post #1365814
Posted Friday, September 28, 2012 6:07 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: 2 days ago @ 12:51 AM
Points: 46, Visits: 136


Goto Expressions :

iif(fields!country.value="","",<field_name>,<field_name>)
Post #1365819
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse