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.
Hopefully this is a simple question. I am computing an average, but the average is not including the days that have a null volume. So instead of computing the average for January using 31 days, the average is only using 16 days. How do I include the null records? The code looks like this.. Thank You!
TABLE FILE SQLOUT SUM LEF_VOLUME/P12C AS 'LEF' GCSS_VOLUME/P12C AS 'GCSS' SSWT_VOLUME/P12C AS 'SSWT' BY FOR_MONTH NOPRINT BY FOR_DATE ON FOR_MONTH SUBTOTAL AVE. * AS 'Average '
I'm reading here you want to include 'nulls' as zero and include zero in the averaging process. Also looks like some code missing here. Only way I can think of is actually compute the average by dividing the 'summed' value by the number of days in the month, which you might have to compute as well.
Leah
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004
Alternative is to used a version of the famed McGyver technique.
Create a temporary file with only a date field and populate it with the dates within the month in which you are interested. Then left_outer join the date field in this file to the date field in your data file, sorting on the output on the date field from the parent.
I have used this method to provide a calendar showing absences, colour coded for type of absence.
A quick piece of code to create a temporary FOCUS file for one month is -
FILEDEF DATEMAS DISK DATERNG.MAS
-RUN
-WRITE DATEMAS FILE=DATERNG,SUFFIX=XFOC
-WRITE DATEMAS SEGNAME=SEG1
-WRITE DATEMAS FIELD=DATE_KEY, ,DMYY ,DMYY , $
-RUN
-* Now create it
CREATE FILE DATERNG
-* and add all possible dates within a month
MODIFY FILE DATERNG
FREEFORM DATE_KEY.A8.
LOG FORMAT MSG OFF
LOG TRANS MSG OFF
LOG INVALID MSG OFF
DATA
-* This repeat loop will ensure at least a whole year is input,
-* Any invalid dates will be rejected.
-DEFAULT &Year = 2008
-SET &Year = EDIT(&YYMD,'9999$');
-SET &Month = EDIT(&YYMD,'$$$$99$');
-SET &Day = 1;
-REPEAT :Loop1 31 TIMES;
-SET &Date = IF &Day LT 10 THEN '0' || &Day ELSE &Day;
&Date&Month&Year
-SET &Day = &Day + 1;
-:Loop1
END
-RUN
TABLE FILE DATERNG
PRINT *
END
-RUN
Note that I repeat the loop 31 times as the max number of days in a month. Because the date field format is a smart date, the process rejects as invalid the dates that are incorrect.
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004