Formatieren des Datums für fremdsprachige Reports
Standard
|Expert
CLOUD ABO
|ON-PREMISES
Leistung & CRM
Budget & Teilprojekt
Fremdkosten
Ressourcen & Projektplanung
Business Intelligence
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.
Ab Version 6.1 gibt es die Möglichkeit, regionsspezifische Zahlenformatierung in Band anzugeben. Informationen dazu finden Sie im Artikel über die Word-Berichte.
In Vertec-Reports vor Version 6.1 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:
(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
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
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
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
Mit formatdatetime('dddd')
kann man das Datum gemäss Ländereinstellungen formatieren und als Wochentag darstellen, 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.