IIF or SWITCH Condition to use and how

  • 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

  • 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

  • Goto Expressions :

    iif(fields!country.value="","",<field_name>,<field_name>)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply