As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
With the help of this forum I was able to come up with a report that would print out a daily count for a specific time period. The report has prompts for start & end dates.
As a test, I ran the report for the period 09/01/2009 - 09/07/2009 which producted the following output. The totals for Day 6 and Day 7 are correct:
DAILY STUDENT COUNT FOR THE PERIOD: 09/01/2009 - 09/07/2009
DAY 1 0 DAY 2 0 DAY 3 0 DAY 4 0 DAY 5 0 DAY 6 24 DAY 7 24
What I would like to be able to do is replace the text labels ie. DAY 1 .. Day 7 with dates so the output would look like the following:
DAILY STUDENT COUNT FOR THE PERIOD: 09/01/2009 - 09/07/2009
The origional report code is displayed below. I was looking to work with the AYMD function but I find working dates and variable assignments can be confusing and frustrating sometimes.
If someone could point me in the right direction I could sure use your assistance.
-SET &ECHO=ALL; -DEFAULT &SD='09/01/2009'; -DEFAULT &ED= '09/07/2009'; -SET &BEGINFMT=DATECVT(EDIT(&SD,'99$99$9999'),'A8MDYY','I8'); -SET &ENDFMT=DATECVT(EDIT(&ED,'99$99$9999'),'A8MDYY','I8'); -SET &NUMDAYS=DATEDIF(&BEGINFMT,&ENDFMT,'D')+1; -TYPE &NUMDAYS; -SET &DAY=0; -SET &BEGDATE = DATECVT(&BEGINFMT,'I8','A8YYMD'); -TYPE &BEGDATE; JOIN T_STUDENTREGISTRATION.TRAININGCLASS_ID IN T_STUDENTREGISTRATION TO T_TRAININGCLASS.ID IN T_TRAININGCLASS AS J0 END
DEFINE FILE T_STUDENTREGISTRATION ADATE/MDYY=HDATE(T_STUDENTREGISTRATION.T_STUDENTREGISTRATION.ARRIVALDATE, 'YYMD'); DDATE/MDYY=HDATE(T_STUDENTREGISTRATION.T_STUDENTREGISTRATION.DEPARTUREDATE, 'YYMD'); -REPEAT THISLOOP &NUMDAYS TIMES DAY&DAY/MDYY=DATEADD('&BEGDATE','D',&DAY); DAYCNT&DAY/I9=IF AD LE DAY&DAY AND DD GT DAY&DAY THEN 1 ELSE 0; -SET &DAY=&DAY+1; -THISLOOP
END TABLE FILE T_STUDENTREGISTRATION PRINT &NUMDAYS &DAY &BEGDATE ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLCSS ON
END TABLE FILE T_STUDENTREGISTRATION SUM -SET &DAY=0; -SET &RAY=1; -REPEAT PRINTLOOP &NUMDAYS TIMES DAYCNT&DAY.EVAL AS 'DAY &RAY' OVER -SET &DAY=&DAY+1; -SET &RAY=&RAY+1; -PRINTLOOP ARRIVALDATE NOPRINT WHERE ( ADATE LE '&ED' ) AND ( DDATE GT '&SD' ); HEADING "DAILY STUDENT COUNT FOR THE PERIOD: <+0>&SD<+0> - <+0>&ED<+0> " " " ENDThis message has been edited. Last edited by: Jeff_Rowland,
This approach avoids use of OVER. The code hasn't been tested so proceed accordingly.
-DEFAULT &SD = '09/01/2009';
-DEFAULT &ED = '09/07/2009';
-* Convert MM/DD/YYYY dates to YYYYMMDD for use with function AYMD.
-SET &START_DATE = EDIT(&SD,'$$$$$$9999') | EDIT(&SD,'99$$$$$$$$') | EDIT(&SD,'$$$99$$$$$');
-SET &END_DATE = EDIT(&ED,'$$$$$$9999') | EDIT(&ED,'99$$$$$$$$') | EDIT(&ED,'$$$99$$$$$');
-*
JOIN T_STUDENTREGISTRATION.TRAININGCLASS_ID IN T_STUDENTREGISTRATION
TO T_TRAININGCLASS.ID IN T_TRAININGCLASS AS J0
END
-*
DEFINE FILE T_STUDENTREGISTRATION
ADATE/YYMD = HDATE(T_STUDENTREGISTRATION.T_STUDENTREGISTRATION.ARRIVALDATE,'YYMD');
DDATE/YYMD = HDATE(T_STUDENTREGISTRATION.T_STUDENTREGISTRATION.DEPARTUREDATE,'YYMD');
END
-* Extract and hold data falling within date range.
TABLE FILE T_STUDENTREGISTRATION
PRINT ADATE
DDATE
BY TRAININGCLASS_ID
WHERE ( ADATE LE '&END_DATE' ) AND ( DDATE GT '&START_DATE' );
ON TABLE HOLD AS DATAHOLD
END
-RUN
-* Use REPEAT loop to calculate DAYCNT for each date in date range.
-* (Increase TO limit if date range might exceed 100 days.)
-REPEAT ENDREPEAT1 FOR &I FROM 0 TO 100
-SET &DATEVAL = AYMD(&START_DATE,&I,'I8');
-*
DEFINE FILE DATAHOLD
DATEVAL/YYMD WITH TRAININGCLASS_ID = '&DATEVAL';
DAYCNT/I9 = IF ( ADATE LE '&DATEVAL' ) AND ( DDATE GT '&DATEVAL' ) THEN 1 ELSE 0 ;
END
-* Hold count results.
TABLE FILE DATAHOLD
PRINT DATEVAL
DAYCNT
BY TRAININGCLASS_ID
ON TABLE HOLD AS CNTHOLD
END
-* Issue command to append successive REPEAT loop processing to existing file.
APP FILEDEF CNTHOLD DISK cnthold.ftm (APPEND
-RUN
-* Exit REPEAT loop if end of date range has been reached.
-IF &DATEVAL EQ &END_DATE GOTO QUITREPEAT1 ;
-*
-ENDREPEAT1
-QUITREPEAT1
-RUN
-*
TABLE FILE CNTHOLD
SUM DATEVAL/MDYY
DAYCNT
BY DATEVAL NOPRINT
END
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
Thanks to all who posted. Your input was very helpful and helps me to become more efficient working with WebFocus. Currently reworking my report to incorporate some of the logic that came for all the posts.