How to: |
One of the most common tasks WebFOCUS procedures can accomplish for your application is executing a report. Include report output in your application in one of the following ways:
Note: If you are using a FOCUS Database Server and are accessing Maintain procedures and WebFOCUS report procedures on the same WebFOCUS Server, you must access them in a particular way to ensure the integrity of your logical transactions. For more information, see Ensuring Transaction Integrity.
For more information on WebFOCUS reports, see the Creating Reporting Applications With Developer Studio and Creating Reports With WebFOCUS Language manuals.
ON TABLE PCHOLD FORMAT HTMTABLE
EXEC procedure [KEEP|DROP] INTO stack;
For more information on KEEP versus DROP, see Persistence Management.
For an example of this method, see WebFOCUS Maintain Advanced Tutorial in the Maintain Getting Started manual.
ON TABLE PCHOLD
Note: If you do not know the names of the columns in your report, create a HOLD file, and then open the file description for the HOLD file to see the column names.
EXEC procedure [KEEP|DROP] INTO stack;
For more information on KEEP versus DROP, see Persistence Management.
Note: The default format of the WebFOCUS Server on which the report is executed must be HTML.
Suppose you created the following report using WebFOCUS Developer Studio and included it in your project:
-* File FANREPT.FEX
TABLE FILE FANNAMES ON TABLE SET PAGE-NUM OFF ON TABLE SET PRINT ONLINE PRINT FIRSTNAME AND COMPANY AND EMAIL BY LASTNAME HEADING "PAGE <TABPAGENO " ON TABLE NOTOTAL -* This command directs WebFOCUS to hold the report results in a stack. ON TABLE PCHOLD ON TABLE SET STYLE * UNITS=IN, PAGESIZE='Letter', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, GRID=ON, FONT=TIMES NEW ROMAN, SIZE=10, COLOR=BLACK, BACKCOLOR=NONE, STYLE=NORMAL, $ ENDSTYLE END
This report displays the Firstname, Company, and Email fields from the Fannames data source, sorted by the Lastname field. Note that the syntax contains the ON TABLE PCHOLD line.
You can execute this report from a WebFOCUS Maintain procedure and save the results in a data source stack. The names of the columns in the data source stack must correspond to the columns in the report (that is, FIRSTNAME, COMPANY, EMAIL, and LASTNAME).
If fannames does not appear in the project path, see How to Add an Existing File to Your Project.
EXEC FANREPT INTO FANSTACK;
You can type all of this code directly or you can generate the EXEC FANREPT part, either with the Language Wizard or by dragging FANREPT from the Project Explorer into the Procedure Editor. You must type INTO FANSTACK by hand.
WebFOCUS Maintain automatically opens the Control Columns dialog box. Ensure FanStack is selected in the list of data source stacks.
Now, when you run your application, WebFOCUS Maintain executes FANREPT and returns the results to FanStack. The HTML Table on Form1 displays the contents of FanStack, as shown in the following image.
Any formatting information in the report is lost (if you wish, you can apply new formatting using the Table Column dialog box). To view formatting inherent in the report, use the ON TABLE HOLD HTMTABLE option, instead of ON TABLE PCHOLD and view the results in an HTML Object.
WebFOCUS |