October 05, 2006, 12:35 PM
jmcgeorgeFinding The Fiscal Year
I need to find out what the current fiscal year is within a define, but I keep getting the following error: (FOC281) ALPHA ARGUMENTS IN PLACE WHERE NUMERIC ARE CALLED FOR
Here is my code:
.....
DAY/A4=TODAY(DAY);
MN/A4=EDIT(DAY, '99$$$$$$$$');
YR/A4=EDIT(DAY, '$$$$$$9999');
FISCAL_YR/A4=
IF MN LT '7'
THEN YR
ELSE YR + 1; -*also tried ELSE YR + '1';
END
If I take away the '+ 1', then I have no problems, but I need to instill the following logic:
if the current month is less than 7
then give me the current year
else give me the current year + 1 (ex: 2006 + 1)
Any ideas? Thanks in advance!
October 05, 2006, 01:04 PM
GlendaTry this code:
TODAY/A8 = '&YYMD';
DAY/A4=EDIT(TODAY, '$$$$$$99');
MN/A2=EDIT(TODAY, '$$$$99$$');
YR/A4=EDIT(TODAY, '9999$$$$');
FISCAL_YR/I4=
IF MN LT '07'
THEN EDIT(YR)
ELSE EDIT(YR) + 1;
END
Glenda
October 05, 2006, 01:15 PM
jmcgeorgeEDIT()!!!! Thank you so much! Works like a charm.
October 05, 2006, 02:44 PM
JimRiceA smart date way:
DEFINE FILE CAR
S_TODAY/YYMD = '&YYMD';
S_DAY/D = S_TODAY;
S_MN/M = S_TODAY;
S_YR/YY = S_TODAY;
F_YR/YY = IF S_MN LT 7 THEN S_YR ELSE S_YR + 1;
END
-*
TABLE FILE CAR
PRINT
CAR
S_TODAY
S_DAY
S_MN
S_YR
F_YR
WHERE RECORDLIMIT EQ 1
END
October 09, 2006, 08:30 PM
PiipsterSo your fiscal year ends in June?
Here's an example that shows what Fiscal year an employee was hired in if the fiscal year ends in June.
DEFINE FILE EMPDATA
HIRE_YM/YYM = HIREDATE;
FISCAL_HIRE/YYM = HIRE_YM +6;
FISCAL_YEAR/YY = FISCAL_HIRE;
END
TABLE FILE EMPDATA
PRINT PIN HIRE_YM FISCAL_HIRE FISCAL_YEAR
BY HIREDATE
END