Elke Schmidt
25th November 2004, 12:52
Hello,
how can I show the current week in a Sessionscript?
And further on, how can I get the current year?
I suppose it shoul look like get.currentweek ()......
Can anybody help me?
Thanks in advance,
Elke
Han Brinkman
25th November 2004, 13:15
Syntax
long num.to.week( long dayno, ref long week_dayno, ref long year_dayno, ref long weekno [, ref long yearno] )
Description
This converts a specified number of days since 01-01-0001 to the corresponding day of the week, day of the year, and week number of the year.
Arguments
dayno A number of days since 01-01-0001.
week_dayno The day of the week. This depends on which day is defined as the first day of the week in the user data settings in the data dictionary.
year_dayno The day number in the year.
weekno The week number in the year. See Week handling.
yearno The year number. This argument is optional.
Notes
If the day of the week lies in the week that includes the turn of the year, weekno returns either 53, 0, or 1. The rules applied are:
§ Yearno argument included
§ If less that 4 days of the week belong to the old year, weekno returns 1 and yearno returns the number of the new year.
§ If 4 or more days belong to the old year, weekno returns 53 and yearno returns the number of the old year.
§ Yearno argument not included
§ If the day belongs to the old year, weekno returns 53.
§ If the day belongs to the new year and there are less that 4 days of the new year in the week, weekno returns 0.
§ If the day belongs to the new year and there are more that 3 days of the new year in the week, weekno returns 1.
Return values
0 success
-1 error
Context
Bshell function.
© 1998 Baan Development B.V. All rights reserved
bdittmar
26th November 2004, 14:06
Something like:
function determine.current.week()
{
long sfc.dayno
long sfc.yeardayno
long sfc.weekno
long sfc.yearno
long week
long year
|converts tisfc001.cmdt (Fertigstellungsdatum)
num.to.week(tisfc001.cmdt, sfc.dayno,sfc.yeardayno,sfc.weekno,sfc.yearno)
week = sfc.weekno
year = sfc.yearno
display("week")
display("year")
refresh()
}
regards Bernd