Focal Point
Dates

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

March 30, 2006, 07:51 AM
Woody
Dates
Has anyone created full list of date variables that may be called as a report object? I am looking to include date values such as prior weekday, prior business day, prior Monday, prior Friday, prior month end date, prior quarter end date, next month end date, next quarter end date, etc. WF provides a routing called DATEMOV which will accomplish many of the requirements, however in WF 7.1.1 not all of them function correctly - especially in Dialogue Manager.


WF 7.6.10 Unix Oracle
March 30, 2006, 09:59 AM
susannah
http://www.aviter.com/
and buy the book 1001 ways to work with dates in focus.
i trust you've masterd the 'dates' chapter in your 'using functions manual'?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
March 30, 2006, 10:35 AM
Tony A
Wasn't too keen on 7.1.1 flavour but looking forward to the 7.1.3. Let's hope that these problems (have they been accepted by IB as "features") are ironed out.

Any of you people out there with the later version able to test and advise please?

Woody, If you have examples of functions that do not work in DM then please share so that we can be armed beforehand Smiler.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
March 30, 2006, 11:09 AM
Woody
Date multipilations are fundamental. And yes, I have "mastered" dates in "Using Functions" manual. My concern is WF 7.1.1. Try the following DM. When using the DATEMOV function with BOM, EOM, BOQ, EOQ, the results are ********. All the others work fine. Thoughts and suggestions welcome.

-SET &TODAY = TODAY('A10');
-SET &PRIBUSDAY = DATEMOV(&YYMD, 'PWD');
-SET &NXTBUSDAY = DATEMOV(&YYMD, 'NWD');
-SET &YESTERDAY = &YYMD-1;
-SET &TOMORROW = &YYMD+1;
-*
-SET &BEGWK = DATEMOV(&YYMD, 'BOW');
-SET &ENDWK = DATEMOV(&YYMD, 'EOW');
-*
-SET &FSTDOM = DATEMOV(&YYMD, 'BOM');
-SET &LSTDOM = DATEMOV(&YYMD, 'EOM');
-*
-SET &BEGQTR = DATEMOV(&YYMD, 'BOQ');
-SET &ENDQTR = DATEMOV(&YYMD, 'EOQ');
-*
-SET &CDAY = EDIT(&YYMD,'$$$$$$99');
-SET &PDAY = EDIT(&YESTERDAY,'$$$$$$99');
-SET &NDAY = EDIT(&TOMORROW,'$$$$$$99');
-TYPE &CDAY - &PDAY - &NDAY
-*
-TYPE TODAY Function &TODAY
-TYPE .
-TYPE Current Day &YYMD
-TYPE Yesterday &YESTERDAY
-TYPE Tomorrow &TOMORROW
-TYPE .
-TYPE Previous Business Day &PRIBUSDAY
-TYPE Next Business Day &NXTBUSDAY
-TYPE .
-TYPE Beginning of Week &BEGWK
-TYPE End of Week &ENDWK
-TYPE .
-TYPE First Day of Month &FSTDOM
-TYPE Last Day of Month &LSTDOM
-TYPE .
-TYPE Beginning of QTR &BEGQTR
-TYPE End of QTR &ENDQTR


WF 7.6.10 Unix Oracle
March 30, 2006, 01:53 PM
Francis Mariani
When manipulating dates in Dialog Manager, I have found that converting the DM variable to date format and then applying the DATEMOV function and then converting back to DM variable works best:

-SET &MONDATE0 =
- DATECVT((DATEMOV((DATECVT(&YYMD,'I8YYMD','YYMD')),'BOW')),'YYMD','I8YYMD');

Not pretty to look at, but it works.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
March 30, 2006, 01:54 PM
Francis Mariani
This is for 5.3 and should work for 7.1


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
December 04, 2007, 10:47 PM
JohnB
Please show how to get DATEMOVE to work in 7.1.3.

For example, if a date is entered as YYYYMMDD, how can you determine what the beginning date of the week is (the previous Sunday, unless the date entered is a Sunday).

Thank you,

John


WF 7.7.03, Windows 7, HTML, Excel, PDF
December 05, 2007, 11:34 AM
Francis Mariani
This should work:

-SET &ECHO=ALL;

-SET &DATE1 = '20071202';

-SET &DOWDATE = (DATECVT(&DATE1,'I8YYMD','W'));
-SET &BOWDATEX = 
-  DATECVT((DATEMOV((DATECVT(&DATE1,'I8YYMD','YYMD')),'BOW')),'YYMD','I8YYMD');
-SET &BOWDATE = IF &DOWDATE EQ 7 THEN &DATE1 ELSE
-  DATECVT((DATEADD((DATECVT(&DATE1,'I8YYMD','YYMD')),'D', -1)),'YYMD','I8YYMD');

-TYPE &DATE1 &BOWDATE


For DATEMOV and myself, the week starts on a Monday. I thought setting BUSDAYS to SMTWTFS would affect DATEMOVE's beginning of the week , but it does not, so moving a date to the previous Sunday takes two steps - first move it to the previous Monday and then subtract one day from the date to move it to the previous Sunday. If it's already a Sunday (day 7) don't do anything.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
December 11, 2007, 12:40 AM
JohnB
Thanks, Francis.

The results are quite what I'm looking for. 20071210 is a Monday. The dates listed should yield 20071209 as the BOW date. This is what the results were:

&DATE1 &BOWDATE Result
-------- -------- ------
20071209 20071209 Sunday (correct)
20071210 20071209 Sunday (correct)
20071211 20071210 Monday (wrong)
20071212 20071211 Tuesday (wrong)
20071213 20071212 Wednesday (wrong)
20071214 20071213 Thursday (wrong)
20071215 20071214 Friday (wrong)

Any suggestions, so that &BOWDATE, yields the beginning of the week every time instead of the previous day?


WF 7.7.03, Windows 7, HTML, Excel, PDF
December 11, 2007, 01:25 AM
susannah
Woody,
quote:
-SET &YESTERDAY = &YYMD-1;
-SET &TOMORROW = &YYMD+1;

For starters, take another crack at the manual.
If &YYMD is 20071231 , then adding 1 to it , while tempting, will give you 20071232, which is not a date.
You need to stay within the date construct.
-SET &TOMORROW = AYMD ( &YYMD, 1, 'I8YYMD');
gives you 20080101
etc.
Another good source is the WebFOCUS KeySheet , a $25 investment worth a zillion, and lists all manner of date variables.
-S.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 11, 2007, 04:53 AM
Tony A
John,

The only thing that I would change within Francis' suggestion would be to this line -
-SET &BOWDATE = AYMD(&BOWDATEX, -1 ,'I8YYMD');

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 11, 2007, 05:08 AM
Tony A
Using your dates -
-SET &DATE1 = '20071209';
-SET &DATE2 = '20071210';
-SET &DATE3 = '20071211';
-SET &DATE4 = '20071212';
-SET &DATE5 = '20071213';
-SET &DATE6 = '20071214';
-SET &DATE7 = '20071215';
-SET &DATE8 = '20071216';
-SET &DATE9 = '20071217';
-RUN
-SET &Cnt = 1;
-REPEAT :Loop 9 TIMES;
-SET &BOWDATEX = DATECVT(DATEMOV(DATECVT(&DATE&Cnt.EVAL,'I8YYMD','YYMD'),'BOW'),'YYMD','I8YYMD');
-SET &BOWDATE = AYMD(&BOWDATEX, -1 ,'I8YYMD');
-TYPE &DATE&Cnt.EVAL &BOWDATE
-SET &Cnt = &Cnt + 1;
-:Loop


Gives -
 20071209 20071209
 20071210 20071209
 20071211 20071209
 20071212 20071209
 20071213 20071209
 20071214 20071209
 20071215 20071216
 20071216 20071216
 20071217 20071216

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 11, 2007, 12:34 PM
susannah
there is a setting to tell WF which day you want to be first day of week...
i'm w/o manuals at the mo' so , uselessly, i can't look it up foryou, but i promise you its there.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 11, 2007, 12:53 PM
susannah
thats the one! thanks Tom




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 11, 2007, 10:31 PM
JohnB
Hi Everyone,

This is what I had com up with:

-SET &DOW_NUMBER1 = (DATECVT(&DATE1,'I8YYMD','W'));
-TYPE DOW_NUMBER1 = &DOW_NUMBER1

-SET &OFFSET = IF &DOW_NUMBER1 NE 7 THEN (&DOW_NUMBER1)* (-1) ELSE 0;
-SET &BOW = AYMD(&DATE1, &OFFSET, 'I8YYMD');
-TYPE OFFSET = &OFFSET BOW = &BOW

AYM and AYMD seem to be easier to use with variables than DATEMOV.


WF 7.7.03, Windows 7, HTML, Excel, PDF
December 12, 2007, 03:10 AM
Tony A
John,

Glad you got it working Smiler

You could replace the OFFSET calc to
-SET &OFFSET = (DATECVT(&DATE&Cnt.EVAL,'I8YYMD','W')) * (((DATECVT(&DATE&Cnt.EVAL,'I8YYMD','W')) NE 7) * (-1));
to give you the same result without having to hold the day number separately.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 12, 2007, 05:11 AM
FrankDutch
quote:
The U.S. English default value is seven (Saturday) meaning that Saturday is the first day of each week


A bit strange...I suppose 7 (as a higher number than 6 and 5 and...) should represent the last day of the week. IMHO Sunday is the last day of the week. (you rest after a whole working week in the WeekEnd).
But apperently Bill Gates rules the agenda nowadays....




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