I'm sure this topic has been discussed but I don't know how to properly search for it. So please forgive me I did try searching before posting this question.
I'm running a FY report that will run based on the current date. For example if the report is generated before July 1st, the range of data will be 07/1/(year-2) through 06/30/(year-1) If report is generated on or after July 1st, the range of data will be 07/1(year-1) through 06/30(year)
Does anyone have an example of how this should be written?This message has been edited. Last edited by: <Kathryn Henning>,
WebFOCUS Keysheet Rel. 8.0.2 (Almost) 1001 Ways to Work with Dates thru Rel. 8.0.2 Focus since 1982 WebFOCUS since the beginning Vivian@aviter.com
August 26, 2015, 07:40 AM
George Patton
The book is extremely valuable even though it could do with a serious redesign. It would help to employ the concept of white space, and put related items on the same or opposite pages, etc. It would be a lot more pages, but much more readable.
I have to run reports on State and Federal Fiscal Years.
The state fiscal year (SFY) is like yours, July-June. The federal fiscal year (FFY) is Oct-Sep.
I use the following DEFINE FUNCTION to take the desired date and return the appropriate fiscal year.
-* File getfy.fex
DEFINE FUNCTION GETFY(INDATE/A8YYMD,YRTYP/A1)
-*
-* For YRTYP S, get SFY for INDATE (Default)
-* For YRTYP F, get FFY for INDATE
-*
INDATE1/YYMD=INDATE;
INMTH/M=INDATE1;
INYEAR/YY=INDATE1;
YRTYP=IF NOT YRTYP IN ('F','S') THEN 'S';
GETFY/I4=
IF YRTYP EQ 'F' AND INMTH LT 10 OR YRTYP EQ 'S' AND INMTH LT 7
THEN INYEAR ELSE INYEAR+1;
END
-RUN
Because I use INDATE as A8YYMD format, I can use this anywhere.
Once I have the year, computing the begin and end dates for the year are simple.