Focal Point
[SOLVED] blank record issue

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/905104164

June 08, 2010, 11:45 AM
Mark1
[SOLVED] blank record issue
Hi,
Simplified example: My table has a balance for month1 and month2, but since there is no balance for month3, there is no record for month3. However, on the held file to export, I still need to have a record for month3. So, needs to look something like this:

month1,deptA,10
month2,deptA,15
month3,deptA,0
month1,deptB,20
month2,deptB,0
month3,deptB,10

Anybody know a quick and dirty way to do this? I was thinking something like this:

TABLE FILE MYTABLE
PRINT DEPT BALANCE
BY MONTH NOPRINT
BY MONTH ROWS 1 OVER 2 OVER 3
END

That gives me the blank record I'm looking for, but I would still have to fill the department number. Not a big deal in my example, but when you have more fields and not knowing which month is going to be blank for which department, gets a little tougher. Thanks!

This message has been edited. Last edited by: Mark1,


Windows version 768
June 08, 2010, 02:41 PM
rfbowley
Quick and dirty, I am afraid not. But there is a way to do what you want to do.

First, create a separate table (TMPTABLE) with three columns, MONTH, DEPT, BALANCE. Make sure that the metadata for these feilds is exactly the same as the matching columns in your table MYTABLE. Now populate this new table with every possible combination of month & department, and the BALANCE column with the value of 0 (zero). This could be a separate database table, or even a FOCUS table that is created / refreshed on a regular basis, perhaps even via the report caster. In any case, index the table on MONTH and DEPT.

Now, in your report do a MORE step:

TABLE FILE MYTABLE
SUM BALANCE
BY MONTH
BY DEPT
MORE
FILE TMPTABLE
SUM BALANCE
BY MONTH
BY DEPT
FILE MYTABLE
SUM BALANCE
BY MONTH
BY DEPT


This should "fill in the spaces" for you.


Robert F. Bowley Jr.
Owner
TaRa Solutions, LLC

In WebFOCUS since 2001
June 08, 2010, 03:31 PM
njsden
Nice! Very interesting technique, Robert.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
June 08, 2010, 06:05 PM
Waz
Twisting your own example....

TABLE FILE MYTABLE
PRINT BALANCE
BY DEPT
BY MONTH ROWS 1 OVER 2 OVER 3
END


And if all the Depts are not there, then the same technque can be done for DEPT. Max two TABLE FILEs.


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!

June 10, 2010, 08:44 AM
GamP
This might also work:

Create a table that holds the months/dept combinations and fill it will all months/dept combinations that you may want to report on at any given moment.
Then join this table based on the month/dept to all instances of your balance (MYTABLE) table month/dept - don't forget to set ALL to be ON or PASS.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
June 10, 2010, 09:55 AM
Tony A
... or in code ... Think of the CAR file. There are 5 countries and 10 cars between them. How would you obtain every combination of country and car possible (e.g. 50 records)?

Answer - use McGyver technique

DEFINE FILE CAR
  MCGYVER_KEY/A1 = '';
END
TABLE FILE CAR
PRINT COUNTRY
   BY MCGYVER_KEY
ON TABLE HOLD AS MCGYVER1
END
TABLE FILE CAR
PRINT CAR
   BY MCGYVER_KEY
ON TABLE HOLD AS MCGYVER2 FORMAT XFOCUS INDEX MCGYVER_KEY
END
JOIN CLEAR *
JOIN MCGYVER_KEY IN MCGYVER1 TO MULTIPLE MCGYVER_KEY IN MCGYVER2 AS J1
TABLE FILE MCGYVER1
PRINT COUNTRY
      CAR
END

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