Focal Point
[SOLVED] Current Week Number of a Year

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7337065826

February 06, 2013, 10:49 AM
Trilochan
[SOLVED] Current Week Number of a Year
I want to calculate Current Week Number of a Year.

I am using WebFOCUS 7.6.1 version.I do not find any function for calculating Current Week Number.

Please help.

Thanks in advance!

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6.1
Windows, All Outputs
February 06, 2013, 11:04 AM
Wep5622
SET WEEKFIRST=ISO

TABLE FILE CAR
PRINT
COMPUTE TODAY/HYYMDS = HGETC(8, TODAY);
COMPUTE WEEKNR/I3 = HPART(TODAY, 'WEEK', 'I3');
BY COUNTRY
END



WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 13, 2013, 04:34 AM
Trilochan
Its working for me.


Thanks Wep5622.......


WebFOCUS 7.6.1
Windows, All Outputs
February 13, 2013, 04:37 AM
Trilochan
I find a another way to solve this problem...


  -SET &TODAY_DT= &YYMD;
-SET &YEAR = EDIT(&TODAY_DT,'9999$$$$$$$$') ;
-SET &WEEK = HPART(HDTTM(DATECVT(&TODAY_DT, I8YYMD, YYMD), 8, 'HYYMDs'), 'WEEK', 'I2');
-SET &WEEK_OF_YEAR=&WEEK+1;
-SET &YEAR_AND_WEEK=&YEAR|| '-' || &WEEK_OF_YEAR;

-SET &WEEKSTART_DT=DATECVT(DATEADD(DATEMOV(DATECVT(&TODAY_DT, 'I8YYMD','YYMD'), 'BOW'), 'D', -1), 'YYMD', 'A8YYMD');
-SET &WEEKEND_DT=DATECVT(DATEADD(DATEMOV(DATECVT(&TODAY_DT, 'I8YYMD','YYMD'), 'EOW'), 'D', 1), 'YYMD', 'A8YYMD');
-SET &START_DATE =  EDIT(&WEEKSTART_DT,'$$$$$$99')|| '/' ||EDIT(&WEEKSTART_DT,'$$$$99$$$$')|| '/' || EDIT(&WEEKSTART_DT,'9999$$$$$$$$');
-SET &END_DATE =  EDIT(&WEEKEND_DT,'$$$$$$99')|| '/' ||EDIT(&WEEKEND_DT,'$$$$99$$$$')|| '/' || EDIT(&WEEKEND_DT,'9999$$$$$$$$');

-TYPE &YEAR_AND_WEEK
-TYPE &START_DATE 
-TYPE &END_DATE



WebFOCUS 7.6.1
Windows, All Outputs
February 13, 2013, 07:05 AM
FrankDutch
There are many ways to solve this.
The difference you see now is the first is in a define so you can easy use it in the report but it might depend on the value of the database.
If you want to calculate the week number of a certain transaction you may use this.

The second is an ampervalue you can create independent of the database value.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7