Upload
derrick-matthews
View
287
Download
13
Tags:
Embed Size (px)
Citation preview
WebFOCUS Tips and Techniques
WebFOCUS Tips and Techniques The Next Generation
WebFOCUS Tips and Techniques
Joyce HalfordJohn Kutasz
Summit User Conference June 2008
WebFOCUS Tips and Techniques
Joyce Halford
WebFOCUS Tips and Techniques
Order Report By or BY TOTAL
WebFOCUS Tips and Techniques
Order Report By or BY TOTAL
WebFOCUS Tips and Techniques
Order Report By or BY TOTAL
WebFOCUS Tips and Techniques
Order Report By or BY TOTAL
WebFOCUS Tips and Techniques
Order Report By or BY TOTAL
WebFOCUS Tips and Techniques
Order Report By or BY TOTAL
WebFOCUS Tips and Techniques
Order Report By or BY TOTAL
WebFOCUS Tips and Techniques
Order Report By or BY TOTAL
WebFOCUS Tips and Techniques
WHENCE
WebFOCUS Tips and Techniques
WHENCE
How can you determine which MASTER is being used when MASTER files exist on multiple platforms for the same data source?
WHENCE filename MASTER
This is only an issue if the MASTER files are different.
An example of this problem can happen if MASTER files are created on a mainframe, copied to a local environment and at a later date, the MASTER files on the mainframe are updated but not copied to the local environment.
WebFOCUS Tips and Techniques
WHENCE
WHENCE CAR MASTER
WebFOCUS Tips and Techniques
WHENCE
FOCEXEC and FOCUS file locations can also be determined using WHENCE
WHENCE filename FOCEXEC
WHENCE filename FOCUS
WebFOCUS Tips and Techniques
WHERE TOTAL
WebFOCUS Tips and Techniques
WHERE TOTAL
WHERE SALARY GT 56200
WebFOCUS Tips and Techniques
WHERE SALARY GT 56200
WHERE TOTAL
WebFOCUS Tips and Techniques
WHERE TOTAL
Subset of Previous Page
WebFOCUS Tips and Techniques
WHERE TOTAL
WebFOCUS Tips and Techniques
WHERE TOTAL
WebFOCUS Tips and Techniques
WHERE TOTAL
WebFOCUS Tips and Techniques
WHERE TOTAL
WebFOCUS Tips and Techniques
WHERE TOTAL
WebFOCUS Tips and Techniques
WHERE TOTAL
WebFOCUS Tips and Techniques
WHERE TOTAL
WebFOCUS Tips and Techniques
Concatenate Fields for Sorting
WebFOCUS Tips and Techniques
Concatenate Fields for Sorting
Report Caster Bursting is on the primary sort field
By concatenating multiple sort fields you can burst at a more detailed level.
WebFOCUS Tips and Techniques
Concatenate Fields for Sorting
WebFOCUS Tips and Techniques
Concatenate Fields for Sorting
WebFOCUS Tips and Techniques
Concatenate Fields for Sorting
WebFOCUS Tips and Techniques
Concatenate Fields for Sorting
WebFOCUS Tips and Techniques
Concatenate Fields for Sorting
WebFOCUS Tips and Techniques
Concatenate Fields for Sorting
WebFOCUS Tips and Techniques
Concatenate Fields for Sorting
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box (Populated from a Table/File)
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box (Populated from a Table/File)
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box (Populated from Focexec Output)
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
How to Build a Dynamic Dropdown Box
WebFOCUS Tips and Techniques
WHERE
WebFOCUS Tips and Techniques
WHERE
Conditional WHERE statements
–SET ¶meter
to control display of WHERE statements
in a TABLE request
Another option is to use a
–GOTO label to jump around WHERE statements
This technique does not allow you to work in the GUI.
WebFOCUS Tips and Techniques
WHERE
Example of -GOTO
–IF &COUNTRY EQ ‘ALL COUNTRIES‘ GOTO SKIPWHR
WHERE COUNTRY EQ &COUNTRY
-SKIPWHR
WebFOCUS Tips and Techniques
WHERE
WebFOCUS Tips and Techniques
WHERE
• –SET ¶meter
WebFOCUS Tips and Techniques
WHERE
• –SET ¶meter
WebFOCUS Tips and Techniques
WHERE
• –SET ¶meter
WebFOCUS Tips and Techniques
WHERE
• –SET ¶meter
WebFOCUS Tips and Techniques
WHERE
• –SET ¶meter
WebFOCUS Tips and Techniques
WHERE
• –SET ¶meter
-* File DMANDWHR.fex-DEFAULT &COUNTRY = 'ENGLAND‘
-SET &SELWHR = IF &COUNTRY EQ 'ALL COUNTRIES' THEN ' '- ELSE 'WHERE COUNTRY EQ ' | '''' | &COUNTRY | '''' ;
TABLE FILE CARPRINT DEALER_COST RETAIL_COST &SELWHRBY COUNTRYBY CARBY MODELBY BODYTYPEHEADING"The following line displays the value of amperSELWHR""&SELWHR"" ""The value of amperCOUNTRY is &COUNTRY"" "FOOTING""...END
WebFOCUS Tips and Techniques
WHERE
• If you use the report layout tool,
an alternate coding technique is used.
WebFOCUS Tips and Techniques
WHERE
ALL SELECTED IN DROPDOWN BOX
TABLE FILE CAR
PRINT COUNTRY MPG
BY COUNTRY
WHERE MPG GE 20
WHERE CAR EQ 'FOC_NONE'
END
WebFOCUS Tips and Techniques
WHERE
AUDI SELECTED IN DROPDOWN BOX
TABLE FILE CAR
PRINT COUNTRY MPG
BY COUNTRY
WHERE MPG GE 20
WHERE CAR EQ ‘AUDI'
END
WebFOCUS Tips and Techniques
Ignoring Code with FOC_NONE
WebFOCUS Tips and Techniques
Ignoring Code with FOC_NONE
• If a parameter has a value of FOC_NONE,
any row of code containing it will be ignored
when the report runs.
• One use for this is the WHERE statement example that you have already seen.
WebFOCUS Tips and Techniques
Ignoring Code with FOC_NONE
-SET &PARM1 = 'FIRST VALUE';-SET &PARM2 = 'SECOND VALUE';-SET &PARM3 = 'THIRD VALUE';
TABLE FILE CARPRINT CARBY COUNTRYHEADING"heading line 1 parm value is: <+0>&PARM1<+0> ""heading line 2 parm value is: <+0>&PARM2<+0> ""heading line 3 parm value is: <+0>&PARM3<+0> "END
WebFOCUS Tips and Techniques
Ignoring Code with FOC_NONE
WebFOCUS Tips and Techniques
Ignoring Code with FOC_NONE
-SET &PARM1 = 'FIRST VALUE';-SET &PARM2 = ‘FOC_NONE';-SET &PARM3 = 'THIRD VALUE';
TABLE FILE CARPRINT CARBY COUNTRYHEADING"heading line 1 parm value is: <+0>&PARM1<+0> ""heading line 2 parm value is: <+0>&PARM2<+0> ""heading line 3 parm value is: <+0>&PARM3<+0> "END
WebFOCUS Tips and Techniques
Ignoring Code with FOC_NONE
WebFOCUS Tips and Techniques
Ignoring Code with FOC_NONE
Notes:
• The ONLY row ignored is the one containing the display or evaluation of the parameter.
• If you have a heading or a selection that wraps to more than one row, only part of it will be ignored, likely causing a syntax error.
The following is an example:
"heading line 2 parm value is: <+0>&PARM2<+0> "
WebFOCUS Tips and Techniques
US Bank Panel
John Kutasz
WebFOCUS Tips and Techniques
Color Matching
WebFOCUS Tips and Techniques
Color Matching
If you want to give logos,
web pages, and reports
a matching look and feel,
Windows comes with something
you can use to identify a
specific color
– the ‘Paint’ tool.
WebFOCUS Tips and Techniques
Color Matching
For Example, I may have a report that contains data for FedEx. If I call up their web site and press Cntl-PrintScreen, I can capture a picture of their page.
WebFOCUS Tips and Techniques
Color Matching
From the Windows XP Desktop, choosing Start / All Programs / Accessories / Paint will bring you to the paint tool.
WebFOCUS Tips and Techniques
Color Matching
Choose Edit / Paste or Cntl-V to paste the clipboard image into the Paint tool. Note that the image you pasted contains a picture of the tool bar from the browser – these controls do NOT work.
WebFOCUS Tips and Techniques
Color Matching
Choose the ‘eyedropper’ tool from the Paint toolkit, and click it on a color you want to match.
You should notice a brief flash of color in the rectangle under the Paint toolkit, but then the screen will go back exactly the way it looked before taking the eyedropper sample.
WebFOCUS Tips and Techniques
Color Matching
From the Paint Menu, choose Colors / Edit Colors / and then Define Custom Colors.
WebFOCUS Tips and Techniques
Color Matching
The image below is zoomed in on the Custom Colors box. The color that was chosen with the eyedropper shows in the rectangle near the bottom, and the exact color settings RGB(102, 0, 153) appear at the bottom right.
WebFOCUS Tips and Techniques
Color Matching
NOTE:
Some images on the web are not made up of solid colors. They may be nearby dots of different colors that blend together to appear as a single color. Sampling may only get you one pixel value.
WebFOCUS Tips and Techniques
Color Matching
NOTE:
Some monitors may not be set to display millions of colors. The ‘web safe’ palette contains 216 colors that all browser settings will show. Any combination of 0, 51, 102, 153, 204, and 255 should be visible on any color monitor.
WebFOCUS Tips and Techniques
Cell Padding How Much Will Fit on a PDF Page?
WebFOCUS Tips and Techniques
Cell Padding How Much Will Fit on a PDF Page?
• This technique uses a very simple report. We are printing:
– the first 8 fields of the CAR file
– with the default font,
– turning gridlines on
– displaying in PDF format.
WebFOCUS Tips and Techniques
Cell PaddingHow Much Will Fit on a PDF Page?
A very simple report built in the GUI tool
WebFOCUS Tips and Techniques
Cell Padding How Much Will Fit on a PDF Page?
The first 6 columns appear on Page 1
WebFOCUS Tips and Techniques
Cell Padding How Much Will Fit on a PDF Page?
The other 2 columns are on Page 2
WebFOCUS Tips and Techniques
Cell Padding How Much Will Fit on a PDF Page?
• Some possible changes:
– Use a smaller font
– Change the report to landscape mode
– Change to legal paper
– Abbreviate column titles to make them narrower.
WebFOCUS Tips and Techniques
Cell Padding How Much Will Fit on a PDF Page?
• This technique does none of those things. Instead, do the following:
– Choose Report / Format from the pulldown at the top of the page
– Go to the option called ‘Cell Padding’. By default, there is a value of ‘not set’. I put in a value of 0.08 for the left and right.
WebFOCUS Tips and Techniques
Cell Padding The stylesheet settings are called LEFTGAP and RIGHTGAP
WebFOCUS Tips and Techniques
Cell Padding You Get Extra Space in 2 Places in EVERY Column
All 8 columns now display on a single page.
WebFOCUS Tips and Techniques
Cell Padding How Much Will Fit on a PDF Page?
• You saw on the previous page that the font and the page size are the same, there is simply less room between the data and the gridlines.
• The benefit here is that a small amount of space is saved in 2 places in every column of the report. It is still surprising to see how much additional room it adds up to.
WebFOCUS Tips and Techniques
Combining Data
WebFOCUS Tips and Techniques
Combining Data
•Universal Concatenation - the MORE command - physically appends multiple files
•The sources can have different formats (Focus, DB2, etc), and some can have more fields than others.
•But, any specific fields being combined need to have the same names, and the same formats.
WebFOCUS Tips and Techniques
Combining Data
•I have always found Excel to be a handy tool for data entry.
•The new Upload Data File option makes it much, much easier to use an Excel file as a data source.
WebFOCUS Tips and Techniques
Combining Data
Step 1 – hold existing data to Excel format
WebFOCUS Tips and Techniques
Combining Data
Step 2 – Using the spreadsheet as a template,
input new data
WebFOCUS Tips and Techniques
Combining Data
New Option – Master Files / New / Upload Data File
WebFOCUS Tips and Techniques
Combining Data
WebFOCUS Tips and Techniques
Combining Data
WebFOCUS Tips and Techniques
Combining Data
Previous Page, Notes:
– Check the master file of the original table (CAR, in this example) and set field formats to match
– Click ‘Apply’ for each field as the format is changed, then move to next field
WebFOCUS Tips and Techniques
Combining Data
Previous Page, Notes, continued:
– Choose your application from the bottom dropdown box.
– If the leftmost column runs off the edge of the page, change to a non-maximized view of the inner window.
WebFOCUS Tips and Techniques
Combining Data
All Fields, All DataTABLE FILE CAR
PRINT COUNTRY CAR MODEL RETAIL_COST DEALER_COST SALES …
ON TABLE HOLD AS ALLCAR
MORE
FILE CARFILENEWDATA
END
TABLE FILE ALLCAR
PRINT COUNTRY CAR MODEL RETAIL_COST DEALER_COST SALES …
BY COUNTRY NOPRINT BY CAR NOPRINT
END
WebFOCUS Tips and Techniques
Combining Data
WebFOCUS Tips and Techniques
Combining Data
Only Selected Fields, Selected Countries
TABLE FILE CARPRINT COUNTRY CAR MODEL WHERE COUNTRY CONTAINS 'GERMANY'ON TABLE HOLD AS ALLCARMOREFILE CARFILENEWDATAWHERE COUNTRY CONTAINS 'GERMANY'ENDTABLE FILE ALLCARPRINT COUNTRY CAR MODELBY COUNTRY NOPRINT BY CAR NOPRINTEND
WebFOCUS Tips and Techniques
Combining Data
WebFOCUS Tips and Techniques
Combining Data
If there is a field in some source files that is not in all of them (for example, a new category for newer cars), a DEFINE can be used to add a blank (or zero) value into the request from tables where it does not exist.
WebFOCUS Tips and Techniques
Combining Data
DEFINE FILE CAR
HYBRID/A50 = ' ';
END
TABLE FILE CAR
PRINT COUNTRY CAR MODEL HYBRID
ON TABLE HOLD AS ALLCAR
MORE
FILE CARFILENEWDATA
END
TABLE FILE ALLCAR
PRINT COUNTRY CAR MODEL HYBRID
BY COUNTRY NOPRINT BY CAR NOPRINT
END
WebFOCUS Tips and Techniques
Combining Data
WebFOCUS Tips and Techniques
Combining Data
Unlike using a JOIN, there is no need for any fields in the source files to have the same value.
Also, since the result is a simple, single segment file, it tends to be very easy to use for reporting (no ‘testing in independent sets of data’).
WebFOCUS Tips and Techniques
ASNAMES
WebFOCUS Tips and Techniques
ASNAMES
• The ASNAMES function allows you to assign the names of fields when you put them into HOLD files.
WebFOCUS Tips and Techniques
ASNAMES
WebFOCUS Tips and Techniques
ASNAMES
WebFOCUS Tips and Techniques
ASNAMES
WebFOCUS Tips and Techniques
ASNAMES
WebFOCUS Tips and Techniques
ASNAMES
A problem arises when you take the identical request and store the results in a hold file. The column title information is not saved into the hold master, and you have 2 fields called SALES.
An additional complication in reporting from a HOLD file is that even if you refer to SALES multiple times, you will always get the values from the first column with that name.
WebFOCUS Tips and Techniques
ASNAMES – the Solution
WebFOCUS Tips and Techniques
ASNAMES – the Solution
WebFOCUS Tips and Techniques
ASNAMES – the Solution
And the values used for the column titles get passed to the HOLD file
WebFOCUS Tips and Techniques
ASNAMES
A potential complication: you use a common method of making column titles look better:
WebFOCUS Tips and Techniques
ASNAMES
The comma used for line wrapping causes only the first part of the name to be captured.
WebFOCUS Tips and Techniques
ASNAMES
Some things to be aware of when holding to FOCUS format files:
TABLE FILE CARSUM SALES AS 'COUNTRYSALES'BY COUNTRYSUM SALES AS 'MODELSALES'BY COUNTRYBY MODELON TABLE HOLD AS HOLDA FORMAT FOCUS INDEX SALES
WebFOCUS Tips and Techniques
ASNAMES
The default value for ASNAMES is ‘FOCUS’, not ‘OFF’. So if you hold to a FOCUS file, ASNAMES will work automatically.
If you are indexing a field (or fields) the instruction on which field(s) to index refers to the originating fieldname, NOT to the value that ASNAMES will assign
If you are indexing a field, the maximum length of an indexed field is 12 characters – so you need to limit the length of these fieldnames.
WebFOCUS Tips and Techniques
ASNAMES
And finally: whenever I am putting an item into a hold file, I try never to use a name for a field that is the same as a ‘real’ fieldname that exists in any of the source master files. This holds true for fields I create with either DEFINE or COMPUTE, as well as for fields being renamed using ASNAMES. Assigning the same name to something that does not represent the original data field can only lead to confusion and misery (if not for you, then for someone trying to use your code in the future).
WebFOCUS Tips and Techniques
WebFOCUS Tips and Techniques
• Questions
WebFOCUS Tips and Techniques
WebFOCUS Tips and Techniques
Thank you for attending