In this section: |
You can enhance the functionality of your webpage by enabling you to include HTML commands in your procedures using the Dialogue Manager -HTMLFORM command. -HTMLFORM supports all standard HTML elements, including character styling, hyperlinks, graphic images, tables, forms, and frames. You can combine a procedure and HTML commands in the following ways:
How to: |
You can include HTML commands in your procedure by specifying an HTML webpage in your procedure.
-HTMLFORM filename
where:
Is the HTML file that contains the target webpage. The name of the HTML file must be in uppercase letters.
If you use separate HTML files, you cannot use Dialogue Manager commands and variables in the file. However, the WebFOCUS escape sequences, described in Including Variables in an HTML Webpage, can be used.
How to: |
You can include HTML commands in a procedure by embedding those commands in a procedure.
Note: The -RUN command cannot be included in the lines between the -HTMLFORM BEGIN and -HTMLFORM END commands.
-HTMLFORM BEGIN . . . -HTMLFORM END
where:
Indicates the beginning of HTML commands.
Indicates the end of HTML commands.
Note: All lines that are not Dialogue Manager commands are assumed to be HTML.
All Dialogue Manager variables referenced within the -HTMLFORM BEGIN and -HTMLFORM END commands are evaluated, even within comment tags, so you should either assign them a default value or escape the ampersand symbol using a pipe character (|) so that it is not interpreted as the start of a variable name. For example, in the following sample, the ampersand is escaped using the pipe character so that the variable definition in the comment is not evaluated:
-HTMLFORM BEGIN <HTML> <HEAD> <SCRIPT> /* escaping the ampersand in a comment: &|x=y */ </SCRIPT> </HEAD> <BODY> Test variable in Javascript comments </BODY> </HTML> -HTMLFORM END
The following procedure contains a report request and the -HTMLFORM command, which customizes the webpage the report is displayed on. The report is centered in the browser window, and displays with the Arial font in blue.
TABLE FILE SHORT SUM PROJECTED_RETURN BY COUNTRY ON TABLE HOLD AS SHORT FORMAT HTMTABLE END
-HTMLFORM BEGIN <HTML><HEAD><STYLE>TD {FONT-FAMILY: ARIAL; COLOR: BLUE; }</STYLE></HEAD> <BODY><DIV ALIGN="CENTER"> !IBI.FIL.SHORT; </DIV></BODY></HTML> -HTMLFORM END
The following webpage is produced:
How to: |
You can embed one or more reports or HTML files into your webpage using -HTMLFORM commands.
To embed a report into a webpage created with -HTMLFORM commands:
ON TABLE HOLD FORMAT HTMTABLE AS reportname
Note: The temporary file created for the output is not available to the user.
-HTMLFORM filename
Note: If you are not using an external HTML file, the HTML commands for the webpage can reside in the same file using -HTMLFORM BEGIN and -HTMLFORM END to separate the HTML commands from the rest of the procedure.
!IBI.FIL.reportname
where:
Is the name of the report file to embed in the Web page.
Note: The designated report name can be up to 512 characters.
Files embedded with the !IBI.FIL escape sequence can contain other escape sequences. If reference is made to a file that does not exist, an error message is returned.
This example shows how to embed multiple HTML reports into one HTML webpage. The following code generates three reports, each consisting of the same automotive data that is sorted three different ways; by country, by body type, and by manufacturer.
TABLE FILE CAR "REPORT 1 - BY COUNTRY" PRINT CAR MODEL BODYTYPE BY COUNTRY ON TABLE HOLD FORMAT HTMTABLE AS REPORT1 ON TABLE SET STYLE * TYPE=HEADING,STYLE=BOLD,COLOR=RED,$ ENDSTYLE END TABLE FILE CAR "REPORT 2 - BY BODY TYPE" PRINT CAR MODEL COUNTRY BY BODYTYPE ON TABLE HOLD FORMAT HTMTABLE AS REPORT2 ON TABLE SET STYLE * TYPE=HEADING,STYLE=BOLD,COLOR=BLUE,$ ENDSTYLE END TABLE FILE CAR "REPORT 3 - BY MANUFACTURER" PRINT MODEL BODYTYPE COUNTRY BY CAR ON TABLE HOLD FORMAT HTMTABLE AS REPORT3 ON TABLE SET STYLE * TYPE=HEADING,STYLE=BOLD,COLOR=GREEN,$ ENDSTYLE END -HTMLFORM BEGIN !IBI.FIL.REPORT1; !IBI.FIL.REPORT2; !IBI.FIL.REPORT3; -HTMLFORM END
The following images show the three reports that are embedded into one HTML document:
Embedding Variables Into One HTML Webpage
This example generates a report consisting of product codes and quantities, and displays the current time and date found in Dialogue Manager system variables. The following explains how the elements required to display this report are combined. The numbers to the left of the example apply to the notes that follow.
Step 1 - First.htm
Set up the webpage that will hold the report. This webpage must be saved in a directory within EDAPATH or APPPATH in order for WebFOCUS to find it. The following file is called first.htm:
<HTML> <BODY> 2. Time: 3. !IBI.FIL.&TOD <BR> 2. Date: 3. !IBI.FIL.&DATE <BR> <HR SIZE=5> 4. <!--WEBFOCUS TABLE UPPER--> </BODY> </HTML>
Note: The HTML comment line must be closed with the ---> characters or a single > character and should not have any other HTML tags within it.
Step 2 - Amper.fex
Create your report request:
TABLE FILE GGORDER SUM QUANTITY BY PCD IF PCD EQ 'B$$$' 1. ON TABLE HOLD FORMAT HTMTABLE AS UPPER END 5. -RUN 6. -HTMLFORM first
Step 3 - Launch.htm
Create a webpage, which launches the report procedure:
<HTML> <BODY> <P> <P> <A HREF="/ibi_apps/WFServlet?IBIF_ex=amper">Click here.</A> </BODY> </HTML>
When the procedure and both webpages have been created, the webpage that launches the procedure can be called from the browser. When the procedure is launched, the report is executed:
The following webpage is generated:
How to: |
In WebFOCUS, you can use Dialogue Manager variables to insert variable values in a webpage. This is done by specifying the variable name using a WebFOCUS escape code. You can use the value of a variable either as text on an HTML webpage or as a value in an HTML form input field. You can include a variable that you have created, or system variables like &DATE (today's date) and &TOD (time of day). A single webpage can contain many variable substitution tags.
To use a variable in a webpage created with the -HTMLFORM commands, the variable must first be declared with -SET or -DEFAULT. See Customizing a Procedure With Variables for information on using variables.
<!--WEBFOCUS VAR [&]&variable-->
or
!IBI.{AMP|GLB}.[&]&variable;
where:
Returns the value of a local variable.
Returns the value of a global variable.
Is a local or global variable.
Note: The HTML comment line must be closed with the ---> characters or a single > character and should not have any other HTML tags within it.
!IBI.{AML|GLL}.[&]&variable;
where:
Returns the length of a local variable.
Returns the length of a global variable.
The syntax for a local variable in a form input field is
<INPUT TYPE=TEXT NAME=variable VALUE="!IBI.AMP.variable;">
where:
Is the variable name.
When making substitutions, the full string is replaced, starting with the exclamation point (!) and ending with the semicolon (;). You cannot include variables whose values include internal escape sequences in your command stream.