Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Best method to generate a list of months in a date range

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Best method to generate a list of months in a date range
 Login/Join
 
Silver Member
posted
I'm going to need to graph a number (ie, count of something) for every month. But it's possible the data has no records during a month that will be during the specified period.

So for example....

2011/01 5
2011/02 0
2011/03 0
2011/04 10

etc.

I can do the counts easily enough, but need the months list to start from. I'd prefer to generate the list of months on the fly, since I'll know the start and end month anyhow. Then I can join the data to that and calculate on from there.

So - has anyone done something like this before? I'd need to generate the list of months as well as the master file, but I'd love to clear both afterwards as if they were a hold file.

I could do a loop with -write in dialogue manager and use a dos command to delete the files afterwards...but surely there must be a better way??

This message has been edited. Last edited by: Keith MacDonald,


WebFOCUS & DataMigrator 7.7.03M
Windows 2003, Windows 2008 x64
 
Posts: 35 | Registered: May 11, 2011Report This Post
Master
posted Hide Post
Would DATEDIF for your start/end date and an M flag work?


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Silver Member
posted Hide Post
Sure, Datedif could work to create the list of dates. I could do that with dialogue manager and -WRITE. But that doesn't generate a master file (automatically) and also leaves a file behind after execution. I was trying to think of a way to...create a hold file? Rather than a SAVE file.


WebFOCUS & DataMigrator 7.7.03M
Windows 2003, Windows 2008 x64
 
Posts: 35 | Registered: May 11, 2011Report This Post
Expert
posted Hide Post
Consider using ROWS or COLUMNS to complete the list of desired months...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
quote:
I was trying to think of a way to...create a hold file?

Start here.

To create a month-dimension file:
EX MAKESEQ, with
FIRST=0,
LAST=(the number of months in the period of interest, minus 1).

DEFINE Month (in FSEQ) as the initial date plus COUNTER months.

Then merge with the original HOLD file (using MATCH FILE) to supply rows with zero-valued statistics for the idle months.

This message has been edited. Last edited by: j.gross,
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Platinum Member
posted Hide Post
Hi Keith,

Take a look at this and see if this might work. This creates a temp file along with a master file.

-*****************************************************************
-*
-SET &BEG_MO = 201006;
-SET &END_MO = 201112;
-*
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-TYPE +++ LOOPER - CREATE DATEFILE +++
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
FILEDEF DATEFILE DISK your_datefile_data.txt
-RUN
-TYPE ******* BEGIN LOOP *******
-SET &THE_MO = &BEG_MO;
-:LOOPER
-TYPE THE_MO ----- &THE_MO
-WRITE DATEFILE &THE_MO
-SET &THE_MO = AYM(&THE_MO, 1, 'I6YYM');
-IF &THE_MO GT &END_MO GOTO :EOF;
-GOTO :LOOPER
-:EOF
-CLOSE
-TYPE ******* END LOOP *******
-RUN
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-TYPE +++ MASTER - YOURDATE +++
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
FILEDEF MASTER DISK yourdate.mas
-RUN
-WRITE MASTER FILE=YOURDATE, SUFFIX=FIX, $
-WRITE MASTER SEGNAME=YOURDATE, SEGTYPE=S0, $
-WRITE MASTER FIELDNAME=YOUR_MO, ALIAS=YOUR_MO, USAGE=YYM, ACTUAL=A06, $
-CLOSE
-RUN
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-TYPE +++ FILEDEF - YOURDATE +++
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
FILEDEF YOURDATE DISK your_datefile_data.txt
-RUN
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-TYPE +++ REPORT - YOURDATE +++
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TABLE FILE YOURDATE
PRINT
YOUR_MO
-*ON TABLE HOLD
END
-RUN
-*****************************************************************

Let me know if you have questions.
Jim


WebFocus 8.201M, Windows, App Studio
 
Posts: 227 | Location: Lincoln Nebraska | Registered: August 12, 2008Report This Post
Member
posted Hide Post
This one is like Jim's, but it uses the -REPEAT.

-* File dates_months.fex
-DEFAULT &STARTDATE     = '2011/01/01';
-DEFAULT &ENDDATE       = '2011/12/31';
-SET &BLANK = ' ';
-SET &NUMBER = DATEDIF(&STARTDATE.QUOTEDSTRING,&ENDDATE.QUOTEDSTRING,'M');
-SET &STARTDATE_A8 = STRIP(10,&STARTDATE.QUOTEDSTRING,'/', 'A8');
FILEDEF TEMPDATES DISK (APPEND
-RUN
-REPEAT RPT_LOOP FOR &COUNTER FROM 0 TO &NUMBER;
-SET &DAYPLUS= DATEADD(DATECVT(&STARTDATE_A8.QUOTEDSTRING,'I8YYMD','YYMD'),'M',&COUNTER);
-SET &TODAY = DATECVT(&DAYPLUS.EVAL,'YYMD','A8YYMD');
-WRITE TEMPDATES NOCLOSE &TODAY.EVAL &COUNTER.EVAL &BLANK.EVAL
-RPT_LOOP
-CLOSE TEMPDATES
FILEDEF MAS DISK TEMPDATES.MAS
-RUN
-WRITE MAS FILENAME=TEMPDATES, SUFFIX=FIX    , $;
-WRITE MAS FIELDNAME=TODAY,ALIAS=, USAGE=A8YYMD, ACTUAL=A8 ,$
-WRITE MAS FIELDNAME=COUNTER,ALIAS=, USAGE=I4, ACTUAL=A4 ,$
-WRITE MAS FIELDNAME=BLANK,ALIAS=, USAGE=A1, ACTUAL=A1 ,$
-CLOSE MAS
TABLE FILE TEMPDATES
PRINT
TODAY
COUNTER
BY BLANK
ON TABLE HOLD AS TEMPDTS FORMAT XFOCUS INDEX BLANK
END
-RUN
TABLE FILE TEMPDTS
PRINT *
END
-EXIT


Gary
 
Posts: 29 | Location: Seattle Washington | Registered: July 08, 2009Report This Post
Silver Member
posted Hide Post
Thanks folks, these are some good ideas!


WebFOCUS & DataMigrator 7.7.03M
Windows 2003, Windows 2008 x64
 
Posts: 35 | Registered: May 11, 2011Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Best method to generate a list of months in a date range

Copyright © 1996-2020 Information Builders