Focal Point
Rolling Year

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

June 12, 2008, 04:17 PM
LDW
Rolling Year
I am trying to create a rolling three-year period for a graph.

TODAY/YYMD=DAYMD(&YYMD, YYMD);
TODAYYR/YY=TODAY;
BEGINYR/YY=TODAYYR - 3;

My BEGINYR would be used in my WHERE statement "WHERE BIRTHYR GT BEGINYR".

It is ignoring my year calculation. Any suggestions?


7.6.8
Windows xp
html
June 12, 2008, 04:39 PM
j.gross
In the first line, the last arg is wrong.
Make it:

TODAY/YYMD=DAYMD(&YYMD, 'YYMD');


- Jack Gross
WF through 8.1.05
June 12, 2008, 04:54 PM
Darin Lee
I think Jack caught your error, but one other thing I wanted to mention. I would HIGHLY suggest doing this calculation in Dialogue Manager using -SET &var= as opposed to a DEFINE. This type of calculation as you are using it cannot be passed to the DBMS so it will basically select *, then do the defines, then throw out the records it doesn't need. If you use DM, you can use the same calculations, but the end result is an &var which has the value substituted in the WHERE as oppposed to comparison agains a defined field. The selection criteria can then be passed directly to the DBMS.

WHERE BIRTHYR GT &BEGINYR.EVAL ;


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
June 12, 2008, 05:10 PM
LDW
Thanks Jack. It appears to be working, however my TODAY and TODAYYR fields return as 2009 now. Other than that it is working correctly. Any idea why 2009 would appear?


7.6.8
Windows xp
html
June 12, 2008, 08:59 PM
j.gross
Same here!

-SET &ECHO=ON;
DEFINE FILE CAR
TODAY/YYMD=DAYMD(&YYMD, 'YYMD');
TODAYYR/YY=TODAY;
BEGINYR/YY=TODAYYR - 3;
END
TABLE FILE CAR
HEADING
"&YYMD &DATE &DATEYYMD "
" "
PRINT TODAY TODAYYR BEGINYR
BY COUNTRY
ON TABLE PCHOLD FORMAT WP
END

echo:

DEFINE FILE CAR
TODAY/YYMD=DAYMD(20080612, 'YYMD');
TODAYYR/YY=TODAY;
BEGINYR/YY=TODAYYR - 3;
END
TABLE FILE CAR
HEADING
"20080612 06/12/08 2008/06/12 "
" "
PRINT TODAY TODAYYR BEGINYR
BY COUNTRY
ON TABLE PCHOLD FORMAT WP
END


output:
  PAGE     1
  
  20080612 06/12/08 2008/06/12
   
  COUNTRY     TODAY       TODAYYR  BEGINYR                                                                                        
  -------     -----       -------  -------                                                                                        
  ENGLAND     2009/06/12  2009     2006   
  FRANCE      2009/06/12  2009     2006   
  ITALY       2009/06/12  2009     2006   
  JAPAN       2009/06/12  2009     2006   
  W GERMANY   2009/06/12  2009     2006   


Obviously there's a problem with DAYMD. Suggested detour:

TODAY/YYMD='&DATEYYMD';


- Jack Gross
WF through 8.1.05
June 13, 2008, 06:45 AM
<Dane>
The DAYMD is for Legacy dates only, no detour necessary.
DEFINE FILE CAR
TODAY/YYMD='&YYMD';
TODAYYR/YY=TODAY;
BEGINYR/YY=TODAYYR - 3;
END
TABLE FILE CAR
PRINT TODAY TODAYYR BEGINYR
BY COUNTRY
END
PAGE 1

COUNTRY TODAY TODAYYR BEGINYR
ENGLAND 2008/06/13 2008 2005
FRANCE 2008/06/13 2008 2005
ITALY 2008/06/13 2008 2005
JAPAN 2008/06/13 2008 2005
W GERMANY 2008/06/13 2008 2005
June 13, 2008, 08:27 AM
Tony A
Dane,

It would be good to know what version and platform you ran that on. Please update your signature so that we can reference your reply to a version and platform.

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 
June 16, 2008, 06:24 AM
<Dane>
I tested it on Dev Studio 764, however the release is irrelevent. This will work on all release that support Smart dates.
June 16, 2008, 11:40 AM
Darin Lee
IMHO, the release date is NEVER irrelevant. Constant code changes and code "tightening" cause little things known as bugs or "undocumented features" that appear and disappear seemingly at random. Smiler and Frowner

There are at least a couple of different current issues where date functions using smart dates do not work consistently between versions.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
June 16, 2008, 02:36 PM
j.gross
quote:
The DAYMD is for Legacy dates only


Ah, yes. DAYMD and "smart" dates use different epochs, 365 days apart:

DAYMD has 1899-12-31 as Day Zero; smart dates, 1900-12-31.


- Jack Gross
WF through 8.1.05