One Column in Different Language

Hi BOBJ’s,

I have a requirement that I need to display a column in spanish and all the other columns in English. So from a date (13-FEB-2012), I need to pull out month and name of the month in Spanish February as (febrero).
I thought to do as below in Oracle but how can I acheive this in Crystal Reports 2008 .

to_char(to_date(event_date, 'DD-MON-YYYY'), 'MON', 'NLS_DATE_LANGUAGE=SPANISH') 

I am using Crystal reports 2008.

Help would be much appreciated.

Thanks
Keerth


Keerth007 :uk: (BOB member since 2009-03-21)

Are you using tables/views in your report or are you using a command?

If you’re using tables or views, you can create a SQL Expression that is similar to the Oracle command that you show in your post. If you’re using a command, add this to the command. If you’re using a stored procedure, you’ll have to modify the stored procedure to include this column.

Another option is to translate it in a formula, somthing like this:


NumberVar YearNum := year({EventDate});
NumberVar MonthNum := month({EventDate});
NumberVar DayNum := day({EventDate});
StringVar result := ToText(DayNum, 0) + '-';
result := result + 
  Switch(MonthNum, 1, <Spanish for Jan>,
             MonthNum, 2, <Spanish for Feb>,
             MonthNum, 3, <Spanish for Mar>,
             ...
             MonthNum, 12, <Spanish for Dec>) + '-' + ToText(YearNum);
result

Note that the example doesn’t do any null handling - if the field can be null, you’ll have to add that as well.

-Dell


hilfy :us: (BOB member since 2007-04-16)

Thanks for your clear reply. I wanted to bring data from Stored procedure and I don’t want to change in the procedure , I wanted to do it in Crystal report level and did as below. Just wondering what if this is not months and some data,Is there a way we can do this in report level to change a column data into Spanish or any supported languages ? I don’t need this at the moment but just asking out of curiosity. Thanks


I did as below.

NumberVar MonthNum := month(cdate({EVENT_DATE}));
StringVar result := ToText(MonthNum, 0) ;
result :=
Switch (MonthNum=1, "enero ",
MonthNum=2, "febrero ",
MonthNum=3, "marzo ",
MonthNum=4, “abril”,
MonthNum=5, “mayo”,
MonthNum=6, “junio”,
MonthNum=7, “julio”,
MonthNum=8, “agosto”,
MonthNum=9, “septiembre”,
MonthNum=10, “octubre”,
MonthNum=11, “noviembre”,
MonthNum=12, “diciembre”)


Keerth007 :uk: (BOB member since 2009-03-21)