Datumsformat in fremdsprachigen Reports
Wenn auf einem deutschsprachigen Betriebssystem ein Report auf englisch ausgedruckt werden soll, gibt es ein Problem mit der Datumsformatierung, da diese auf die aktuellen Ländereinstellungen achtet. Word bietet keine Möglichkeit, ein fremdsprachiges Format anzugeben.
In Vertec-Reports kann man das via OCL-Expression trotzdem erreichen. Wenn man zum Beispiel den Monatsnamen im Datum in einer Fremdsprache ausgeschrieben haben will, kann das wie folgt geschehen:
Englisch
(if datum.month = 1 then 'January' else if datum.month = 2 then 'February' else if datum.month = 3 then 'March' else if datum.month = 4 then 'April' else if datum.month = 5 then 'May' else if datum.month = 6 then 'June' else if datum.month = 7 then 'July' else if datum.month = 8 then 'August' else if datum.month = 9 then 'September' else if datum.month = 10 then 'October' else if datum.month = 11 then 'November' else 'December' endif endif endif endif endif endif endif endif endif endif endif) + ' ' + datum.day.asstring + ', ' + datum.year.asstring
- ergibt z.B. March 12, 2011
datum.day.asstring + ' ' + (if datum.month = 1 then 'January' else if datum.month = 2 then 'February' else if datum.month = 3 then 'March' else if datum.month = 4 then 'April' else if datum.month = 5 then 'May' else if datum.month = 6 then 'June' else if datum.month = 7 then 'July' else if datum.month = 8 then 'August' else if datum.month = 9 then 'September' else if datum.month = 10 then 'October' else if datum.month = 11 then 'November' else 'December' endif endif endif endif endif endif endif endif endif endif endif) + ' ' + datum.year.asstring
- ergibt z.B.: 12 March 2011
Französisch
datum.day.asstring + ' ' + (if datum.month = 1 then 'janvier' else if datum.month = 2 then 'février' else if datum.month = 3 then 'mars' else if datum.month = 4 then 'avril' else if datum.month = 5 then 'mai' else if datum.month = 6 then 'juin' else if datum.month = 7 then 'juillet' else if datum.month = 8 then 'août' else if datum.month = 9 then 'septembre' else if datum.month = 10 then 'octobre' else if datum.month = 11 then 'novembre' else 'décembre' endif endif endif endif endif endif endif endif endif endif endif) + ' ' + datum.year.asstring
- ergibt z.B.: 12 mars 2011
Italienisch
datum.day.asstring + ' ' + (if datum.month = 1 then 'gennaio' else if datum.month = 2 then 'febbraio' else if datum.month = 3 then 'marzo' else if datum.month = 4 then 'aprile' else if datum.month = 5 then 'maggio' else if datum.month = 6 then 'giugno' else if datum.month = 7 then 'luglio' else if datum.month = 8 then 'agosto' else if datum.month = 9 then 'settembre' else if datum.month = 10 then 'ottobre' else if datum.month = 11 then 'novembre' else 'dicembre' endif endif endif endif endif endif endif endif endif endif endif) + ' ' + datum.year.asstring
- ergibt z.B.: 12 marzo 2011
Formatieren des Wochentags
Es gibt keinen OCL-Operator, um den Wochentag herauszufinden. Mit formatdatetime('dddd') kann man das Datum zwar gemäss Ländereinstellungen formatieren lassen, aber für die fremdsprachigen Reports braucht man die Nummer des Wochentags. Dies kann man mit Hilfe des Operators mondayOfWeek berechnen. Die Expression lautet dann wie folgt:
(datum.dateToFloat - datum.mondayofweek.dateToFloat)->collect(x| if x=0 then 'Montag' else if x=1 then 'Dienstag' else if x=2 then 'Mittwoch' else if x=3 then 'Donnerstag' else if x=4 then 'Freitag' else if x=5 then 'Samstag' else if x=6 then 'Sonntag' else '' endif endif endif endif endif endif endif)->first
Je nach Sprache können nun die Wochentage entsprechend benannt werden.
| erstellt: | 01.06.2007 |
|---|---|
| geändert: | 09.12.2011: Formatierung von Wochentagen eingefügt. |
| Produktlinien: | Standard, Expert |
| Module: | Leistung & CRM |
