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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
Fill Data Holes
 Login/Join
 
Gold member
posted
I have a (HOLD) table with the following data:

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
 
Posts: 79 | Registered: May 02, 2006Report This Post
Guru
posted Hide Post
IIRC I have used the McGuyver technique in such a situation.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Virtuoso
posted Hide Post
Use ROWS...OVER...

TABLE FILE WHATEVER
SUM AMT
BY CODE
BY YEAR
BY QTR ROWS 1 OVER 2 OVER 3 OVER 4
END


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Gold member
posted Hide Post
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

TABLE HOLDA

YR QTR PASSED AMT
--- --------- ----
2007 1 $100
2007 2 $200
2007 3 $225
2007 5 $400
2008 1 $200

I need to fill in the missing data as shown below

TABLE HOLDB

YR QTR PASSED AMT
--- --------- ----
2007 1 $100
2007 2 $200
2007 3 $225
2007 4 $0 <--new row
2007 5 $400
2007 6 $0 <--new row
2008 1 $200
2008 2 $0 <--new row

How can I get to Table HOLDB with only the data in HOLDA


Webfocus 7.6.4
Windows 2003 Server, SQL Server 2005
Excel, HTML , JavaScript ,and PDF.
Reportcaster, BID, Tomcat
 
Posts: 79 | Registered: May 02, 2006Report This Post
Expert
posted Hide Post
I think Mickey is on the right track.

Do you know how many quaters are expected per year ?

I think if you use ROWS 1 through 6, then on the next TABLE FILE, throw away the ones you don't want, you will get what you want.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
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 Frowner).

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, 2004Report This Post
Virtuoso
posted Hide Post
Jammer,
I am a stubborn proponent of the McGuyver technique.

JAMMER master:
  
FILE=JAMMER, SUFFIX=FIX,
   DATASET=C:\IBI\APPS\FOCALPOINT\JAMMER.TXT
 SEGNAME=SEG1, SEGTYPE=S0
 FIELD=CODE, ALIAS=CD, USAGE=A1, ACTUAL=A1, $
 FIELD=YR, ALIAS=YR, USAGE=YY, ACTUAL=A4, $
 FIELD=QTR, ALIAS=QTR, USAGE=I1, ACTUAL=A1, $
 FIELD=AMT, ALIAS=AMT, USAGE=I5C, ACTUAL=A3, $


JAMMER data:
  
A20071100
A20072200
A20074225
A20081100
A20082200
B20071100
B20072200
B20073225
B20074100
B20081200


JAMMER procedure:
  
-* 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, 2006Report This Post
Gold member
posted Hide Post
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
 
Posts: 79 | Registered: May 02, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders