I was told to make 4 reports for our different teams ( acct. mtg...)I made each report and had the user enter a specific week range. This report shows what each employee is working on and shows how long they spent on a specific task. Then it adds up the hours and minutes and displays the total. Now the users would like the report to run every Tuesday. The reports should run from the previous week (sun-sat). I know to scheduel the reports in Report Caster but what I am having trouble with is the date parameters. No one will enter the date range so how do I tell the report to run the previous week from Tuesday? Any help is appreciated.
Here is my code for one team. All of the code is the same for the other 3 teams.
JOIN
INNER MASTER14.MASTER14.MRID IN MASTER14 TO MULTIPLE
MASTER14_TIMETRACKING.MASTER14_TIMETRACKING.MRID IN MASTER14_TIMETRACKING
TAG J0 AS J0
END
JOIN
INNER J0.MASTER14_TIMETRACKING.MRTIMEUSER IN MASTER14 TO MULTIPLE
CM_USERS.CM_USERS.USER_ID IN CM_USERS TAG J1 AS J1
END
JOIN
INNER J1.CM_USERS.USER_ID IN MASTER14 TO MULTIPLE
VPCR_TEAMMEMBERS.VPCR_TEAMMEMBERS.TEAMMEMBER IN VPCR_TEAMMEMBERS TAG J4 AS J4
END
TABLE FILE MASTER14
SUM
COMPUTE EnrtyDate/YYMD = HDATE(J0.MASTER14_TIMETRACKING.MRTIMEDATE, 'YYMD'); NOPRINT
BY 'J4.VPCR_TEAMMEMBERS.TEAMNAME' AS 'TEAM NAME'
BY 'J1.CM_USERS.REAL_NAME' AS 'Name'
BY 'J0.MASTER14_TIMETRACKING.MRTIMEDATE' NOPRINT
PRINT
COMPUTE EDate/MDYY = DATECVT(EnrtyDate, 'YYMD', 'MDYY'); AS 'Entry Date'
COMPUTE Temp1/A10 = RJUST(10, J0.MASTER14_TIMETRACKING.MRTIMESPENT, Temp1); NOPRINT
COMPUTE Temp2/A9 = SUBSTR(10, Temp1, 1, 9, 9, Temp2); NOPRINT
COMPUTE TodaysDate/MDYY = DATEADD(&MDYY, 'D', -14);
COMPUTE Temp3/D9 = EDIT(Temp2); NOPRINT
COMPUTE Hours/D9 = INT(Temp3 / 60);
COMPUTE Minutes/D5 = DMOD(Temp3, 60, Minutes);
'J0.MASTER14_TIMETRACKING.MRCOMMENT' AS 'Time Entry Comment'
'J0.MASTER14_TIMETRACKING.MRID' AS 'PCR/IR#'
'MASTER14.MASTER14.MRTITLE' AS 'Brief Description'
'J0.MASTER14_TIMETRACKING.MRTIMESPENT' NOPRINT
COMPUTE EDate/MDYY = DATECVT(EnrtyDate, 'YYMD', 'MDYY'); NOPRINT
BY 'J4.VPCR_TEAMMEMBERS.TEAMNAME' AS 'TEAM NAME'
BY 'J1.CM_USERS.REAL_NAME' AS 'Name'
BY 'J0.MASTER14_TIMETRACKING.MRTIMEDATE' NOPRINT
ON J1.CM_USERS.REAL_NAME SUBTOTAL
SUM. Temp3 AS 'Total for '
ON J1.CM_USERS.REAL_NAME RECAP
Hrs/D9 = INT(Temp3 / 60);
Mins/D2 = DMOD(Temp3, 60, Mins);
HEADING
"IT ACCT Time Tracking for the time period &BeginDate thru &EndDate"
FOOTING
""
WHERE ( J4.VPCR_TEAMMEMBERS.TEAMNAME IN ('ACCT Team') ) AND ( J0.MASTER14_TIMETRACKING.MRTIMEDATE GE DT(&BeginDate) ) AND ( J0.MASTER14_TIMETRACKING.MRTIMEDATE LT HADD ( DT(&EndDate) , 'DAY' , 1 , 8 , 'HYYMDs' ) );
ON TABLE PCHOLD FORMAT PDF
This message has been edited. Last edited by: Kerry,
November 22, 2010, 01:32 PM
Darin Lee
Use Dialogue manager to calculate the date range and then use that value as a paramter for your report. Probably would be easiest to get system date, use DATEMOV to move to the beginning of week (BOW) and then DATEADD to subtract one week. Using this technique, a user could run the report at any time during the week and get the data for the previous week.
Specifics for using those funtions are in the online help or "Using Functions" manual.
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
November 22, 2010, 01:59 PM
GamP
A possible example might be:
DEFINE FILE SYSTABLE
NOW/YYMD = '20101125';
DOW/W = NOW;
LESS/I4 = DECODE DOW(7 1 1 2 2 3 3 4 4 5 5 6 6 7);
ENDDATE/YYMD = NOW - LESS;
STARTDATE/YYMD = ENDDATE - 7;
END
TABLE FILE SYSTABLE
ON TABLE SET PREVIEW ON
SUM FST.STARTDATE FST.ENDDATE
ON TABLE SAVE
END
-RUN
-READ SAVE &STARTDATE.8. &ENDDATE.8.
-TYPE &STARTDATE = &ENDDATE