Sie sind auf Seite 1von 37

Bob Zinn

bzinn@uncg.edu

University of North Carolina


Greensboro
System Date and Time Variables
Distinct Field Values
Limiting Rows Retrieved
Selected SET Options
FILECOMPRESS
PREVIEW
EMPTYCELLS
JOINOPT
PAGE NOLEAD
PLUS OTHERS
Sub Reports
Date and Time variables are best used in page headings or footings
The values are set at the start of report execution
The values dont change for the entire report execution

Should you require current date rather than the starting date in a
report, use the WebFOCUS function TODAY or TODAY2

Should you require current time rather than the starting time in a
report, use the WebFOCUS function HHMMSS

Note: Functions are invoked via COMPUTE , DEFINE or


Dialogue Manager -SET commands

Time Variable: &TOD=06.45.10


&DATE=03/14/12 &DATEM=03
&DATEYYMD=2012/03/14 &DATEMT=MAR
&DATEMDYY=03/14/2012 &DATEMtr=March
&DMY=140312 &DATEYY=2012
&DMYY=14032012
&DATEQ=Q1
&MDY=031412
&MDYY=03142012 &DATEYYQ=2012 Q1
&YMD=120314
&YYMD=20120314 &DATEMtDYY=Mar 14, 2012
&DATEMtrDYY=March 14, 2012
&DATED=14 &DATEwrMtrDYY=
&DATEW=3 Tuesday, March 14 2012
&DATEWR=WEDNESDAY &DATED-&DATEMT-&DATEYY=
&DATEwr=Wednesday 14-MAR-2012
SUM/COUNT/PRINT DST.fieldname
Description: Distinct prefix operator (DST.)
aggregates and displays unique values of
any data source field
May be used in conjunction with
aggregate prefix operators SUM. / CNT. /
AVE.
Supported with BY, ACROSS, and FOR
SUM/COUNT/PRINT DST.fieldname
Implementation of DST. is limited in
WebFOCUS 7.6
Multiple DST. operators supported in
TABLE/F in WebFOCUS 7.7
TABLE FILE STUDENT_EVENT
SUM CNT.DST.ID
CNT.ID
BY AGE
ON TABLE COLUMN-TOTAL
WHERE AGE LE 30;
END

Note the count differences between the distinct


and non-distinct columns
TABLE FILE GGSALES
PRINT DST.REGION
DST.ST
DST.CITY
END

Note that the result eliminates duplicate


values and sorts the data
SET PRINTDST = OLD | NEW
Description: Controls how a query processes
multiple DST operators with the PRINT command
Available in WebFOCUS 7.7
Default is OLD
OLD - Multiple DST operators in a PRINT request
are processed as dependent objects
NEW - Multiple DST operators in a PRINT request
are processed as independent objects
Twoways to limit the number of
rows/records retrieved

READLIMIT and/or RECORDLIMIT

With
relational databases it is
recommended to use READLIMIT
READLIMIT limits the number of read
operations (not records) performed
Translated to SQL
Best used with non-FOCUS data sources

RECORDLIMIT limits the number of


records retrieved irrespective of the
number read operations
Not translated to SQL
Best used with FOCUS data sources
TABLE FILE STUDENT_EVENT
SUM CNT.DST.NAME
BY EVENT
BY DEPARTMENT
WHERE READLIMIT EQ 20;
END

Note that the report count equals 20


Only 20 read operations were performed
SET FILECOMPRESS = OFF | ON
Description: Compresses size of PDF files
Default is OFF
Not listed in SET Tool 7.6.10
File compression up to 60%
SET PREVIEW = OFF | ON
Description: Displays ten rows of sample
data
Default is OFF
Not listed in SET Tool 7.6.10
Display depends on field format
Axxxxxx or 999999.99
No data is retrieved from database
SET EMPTYCELLS = ON | OFF
Description: Determines how null values
are displayed in Excel spreadsheets
Default is ON
Not listed in SET Tool 7.6.10
ON - Spaces are displayed
OFF - Zero or value of NODATA is
displayed
SET JOINOPT = OLD | NEW
Default is OLD
OLD - Does not correct lagging values or
support data type conversion
NEW - Corrects lagging values when a
parent segment has multiple unique
segments; Enables joins with different
numeric data types
ON TABLE SET PAGE NOLEAD
Description: Eliminates two blank lines that
normally occur before the report output
Nodefault
Must be used with ON TABLE SET
You can restrict the number of sort values
displayed in a sort phrase
Using the PLUS OTHERS phrase, you can
aggregate all other values to a separate
group and display this group as a report
row
TABLE FILE STUDENT_EVENT
COUNT NAME
BY EVENT
BY TOP 2 DEPARTMENT
PLUS OTHERS
WHERE READLIMIT EQ 20;
END

Note that the report count equals 20


Sub reports are a report with a report
There are several methods for creating
sub reports only one is shown here
In this example, the procedure relies on a
matrix to isolate the data for each report
Lets examine the report, the data and
code
-* Query to view selected data fields
TABLE FILE GGSALES
PRINT CATEGORY REGION
ST UNITS DOLLARS
BUDUNITS BUDDOLLARS
IF RECORDLIMIT EQ 12
END
-* Query to obtain data for first report
TABLE FILE GGSALES
SUM COMPUTE C_SORT/I5 = 1;
UNITS DOLLARS BUDUNITS BUDDOLLARS
COMPUTE C_CAT/A11 = ' ';
COMPUTE C_DOL/I8S = 0;
COMPUTE C_BDOL/I8S = 0;
BY REGION
BY ST
ON TABLE HOLD AS MYSUB FORMAT ALPHA
END
-RUN
FILEDEF MYSUB DISK mysub.ftm (APPEND
-* Query to obtain data for second report
TABLE FILE GGSALES
SUM COMPUTE C_ST/A2 = ' ';
COMPUTE C_SORT/I5 = 2;
COMPUTE C_UNITS/I8S = 0;
COMPUTE C_DOLLARS/I8S = 0;
COMPUTE C_BUDUNITS/I8S =0;
COMPUTE C_BUDDOLLARS/I8S = 0;
COMPUTE C_CAT/A11=MAX.CATEGORY;
COMPUTE C_DOL/I8S=DOLLARS;
COMPUTE C_BDOL/I8S=BUDDOLLARS;
BY REGION BY CATEGORY NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS MYSUB FORMAT ALPHA
END
To put it together we need to create a
single HOLD file that has both sets of data
Use a FIELDEF command with APPEND
option
The FILEDEF must come before the
second query

FILEDEF MYSUB DISK mysub.ftm (APPEND


-* Query to produce the final report
TABLE FILE MYSUB
PRINT C_UNITS IN 20 AS ''
C_DOLLARS AS ''
C_BUDUNITS AS ''
C_BUDDOLLARS AS ''
C_CAT IN 15 AS ''
C_DOL IN 25 AS ''
C_BDOL IN 35 AS ''
BY REGION AS ''
BY C_SORT NOPRINT
BY C_ST AS '
ON REGION SUBHEAD
""
"Region<+0>State<+0>Units<+0>Dollars
<+0>Bud Units<+0>Bud Dollars"
ON C_SORT SUBHEAD
" "
"Category<+0>Actuals<+0>Budgets"
WHEN C_SORT EQ 2;
ON C_SORT SUBFOOT
" "
WHEN C_SORT EQ 2;
ON TABLE SET STYLE *
UNITS=INCHES, PAGESIZE=LETTER,
TOPMARGIN=0.500, BOTTOMMARGIN=0.500,
LEFTMARGIN=0.500, RIGHTMARGIN=0.500,
FONT=ARIAL, SIZE=10, SQUEEZE=OFF, ORIENTATION=LANDSCAPE,$
TYPE=SUBHEAD, LINE=2, STYLE=BOLD+UNDERLINE,$
$ Report One
TYPE=SUBHEAD, BY=REGION, LINE=2, OBJECT=TEXT, ITEM=1,JUSTIFY=LEFT, POSITION=P1,$
TYPE=SUBHEAD, BY=REGION, LINE=2, OBJECT=TEXT, ITEM=2,JUSTIFY=LEFT, POSITION=P2,$
TYPE=SUBHEAD, BY=REGION, LINE=2, OBJECT=TEXT, ITEM=3,JUSTIFY=RIGHT, POSITION=P3,$
TYPE=SUBHEAD, BY=REGION, LINE=2, OBJECT=TEXT, ITEM=4,JUSTIFY=RIGHT, POSITION=P4,$
TYPE=SUBHEAD, BY=REGION, LINE=2, OBJECT=TEXT, ITEM=5,JUSTIFY=RIGHT, POSITION=P5,$
TYPE=SUBHEAD, BY=REGION, LINE=2, OBJECT=TEXT, ITEM=6,JUSTIFY=RIGHT, POSITION=P6,$
$ Report Two
TYPE=SUBHEAD, BY=C_SORT, LINE=2, OBJECT=TEXT, ITEM=1, JUSTIFY=LEFT, POSITION=P7,$
TYPE=SUBHEAD, BY=C_SORT, LINE=2, OBJECT=TEXT, ITEM=2, JUSTIFY=RIGHT, POSITION=P8,$
TYPE=SUBHEAD, BY=C_SORT, LINE=2, OBJECT=TEXT, ITEM=3, JUSTIFY=RIGHT, POSITION=P9,$
-*
TYPE=SUBHEAD, BY=REGION, BORDER-BOTTOM=ON,$
ENDSTYLE
ON TABLE SET PAGE NOPAGE
ON TABLE SET ONLINE-FMT PDF
END

Das könnte Ihnen auch gefallen