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.
CODE YR QTR AMT A 2007 1 100 A 2007 2 200 A 2007 4 225 A 2008 1 100 A 2008 2 200 B 2007 1 100 B 2007 2 200 B 2007 3 225 B 2007 4 100 B 2008 1 200
But I need to fill in some 'missing data' within the periods of 2007 1st Quarter and 2008 2nd Quarter The "Missing Data" is: Code A Year 2007 Quarter 3 (Amt = 0) Code B Year 2008 Quarter 2 (Amt = 0)
I'd like the final (HOLD) table to be:
CODE YR QTR AMT A 2007 1 100 A 2007 2 200 A 2007 3 0 A 2007 4 225 A 2008 1 100 A 2008 2 200 B 2007 1 100 B 2007 2 200 B 2007 3 225 B 2007 4 100 B 2008 1 200 B 2008 2 0
I guess I need to use DM with repeat and writes? Any suggestions?
Webfocus 7.6.4 Windows 2003 Server, SQL Server 2005 Excel, HTML , JavaScript ,and PDF. Reportcaster, BID, Tomcat
The 'ROWS...OVER" will not work since the quarters will vary - and I still have more processing to do on the hold file. (The McGyver may work but I think there is still a better solution - but I don't know it.)
I over-simplified what I needed so let me try to explain my problem once again.
I am running a report for 2nd quarter 2008
For Year 2007 I need data for all 6 quarters passed - from 1st quarter 2007 thru 2nd quarter 2008
For Year 2008 I need data for just 2 quarters passed - from 1st quarter 2008 to 2nd quarter 2008
Let say for example I have the following data in a hold file
If you have a predicatble, unchanging, range of quarter values then using OVER as Mickey suggests is the method to use.
However, if you do not know your range then using a method similar to McGyver (but not quite the same) would be the better method. McGyver uses a "loose" join scenario to create data "out of thin air" but that is not exactly what you want. You need to be able to build your data values and use them as the parent file combined via a LEFT OUTER join to your actual data file (even if that does give you a one to many join ).
I use a similar technique to force a complete range of dates into a calendar type fex where only days of absence exist and the end user requires a complete date range. You could easily adapt the code (see below) to account for quarter values by using the appropriate WF date function.
-* The &Year is defaulted here but can easily be supplied via user input.
-DEFAULT &Year = 2006
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 year
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,
-* NOTE: Because the field is an internal dat, any invalid dates will be rejected.
-SET &Day = 1;
-SET &Month = 1;
-SET &Yearx = &Year;
-REPEAT :Loop1 2 TIMES;
-REPEAT :Loop2 12 TIMES;
-REPEAT :Loop3 31 TIMES;
-SET &Date = IF &Day LT 10 THEN '0' || &Day ELSE &Day;
-SET &Mnth = IF &Month LT 10 THEN '0' || &Month ELSE &Month;
&Date&Mnth&Yearx
-SET &Day = &Day + 1;
-:Loop3
-SET &Day = 1;
-SET &Month = &Month + 1;
-:Loop2
-SET &Day = 1;
-SET &Month = 1;
-SET &Yearx = &Yearx + 1;
-:Loop1
END
-RUN
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
-* File JAMMER2.fex
-SET &ECHO=ALL;
-*
-* from-to limits
-DEFAULT &FRQTR='2007 Q1', &TOQTR='2008 Q4'
-*
SET HOLDLIST=PRINTONLY
-*
-* Join your file to McGuyver
JOIN CLEAR *
JOIN BLANK WITH QTR IN JAMMER TO BLANK IN FSEQ AS W_
-*
-* Define a FOCUS date for Quarter
DEFINE FILE JAMMER
BLANK/A1 WITH QTR = ' ';
YRQ/YYQ=YR;
YRQTR/YYQ=YRQ + QTR -1;
B_YRQTR/YYQ='&FRQTR';
E_YRQTR/YYQ='&TOQTR';
-*
-* the running quarter to get all quaterly dates
ALLYRQTR/YYQ=B_YRQTR + COUNTER -1;
END
-*
-* generate all quarters
TABLE FILE JAMMER
BY CODE
BY ALLYRQTR
WHERE ALLYRQTR GE B_YRQTR
WHERE ALLYRQTR LE E_YRQTR
ON TABLE HOLD AS ALLQRTRS
END
-*
-* match all quarters to existing ones
MATCH FILE JAMMER
SUM
AMT
BY CODE
BY YRQTR
RUN
FILE ALLQRTRS
BY CODE
BY ALLYRQTR AS YRQTR
AFTER MATCH HOLD NEW
END
-*
-* show output
TABLE FILE HOLD
PRINT AMT
BY CODE
BY YRQTR
END
Should do the trick.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
Thank you all for your suggestions - I think each one would work.
I tried Mickey's suggestion with the 'ROWS OVER' and as Waz said - throwing out the ones I don't want. (This seemed like the easiest solution). It seems to be working!
Webfocus 7.6.4 Windows 2003 Server, SQL Server 2005 Excel, HTML , JavaScript ,and PDF. Reportcaster, BID, Tomcat