abas-ERP (FO- Language): Getting Weekday of abas date

383 views Asked by At

Is there any FO function for getting the weekday of an abas date as short. e.g.: Today: 07.04.2016 -> Thursday (th) ?

2

There are 2 answers

2
Frank On BEST ANSWER

In example, when you have;

.type GD xddate                 ? _F|defined(U|xddate)
.type int xidate               ? _F|defined(U|xidate)
..
!START
.formula U|xddate = "."
.formula U|xidate = U|xddate//7
.println 'F|tostring(U|xidate)'

The variable U|xtdate will continue "4" which is the fourth day of the week, Thursday.

0
Alexander Baltasar On

Another deeper approach would be, to get the name of the weekday from the built-in dictionary.

See in HOMEDIR/msg.cc.dic which number monday has (in my case 420) Then this FO-line

.type text xtweekday
.type GD xddate
.formula U|xddate = "09.04.2016"
.atext -language E xtweekday 'F|eval(420 + U|xddate//7)'

'xtweekday' returns Saturday

for "today" just write

.atext -language E xtweekday 'F|eval(420 + G|date//7)'

You can also use the more powerfull .translate command, but this is in this case not really necessary.