How to: |
You can add a dynamic multiselect drop-down list whose values are populated by field values retrieved live from a data source. The data source is allocated dynamically with no fixed maximum record length.
This procedure uses the Dialogue Manager command –HTMLFORM to populate a drop-down list with values from a data source. Use this technique when selection values change frequently, to ensure that you always derive a list of current valid values.
For details on -HTMLFORM, see Designing an HTML Page for Report Display.
For example, on Windows, the command is
FILEDEF textfile DISK APP/textfile.TXT
where:
Is the name of the file that contains the values.
Is the name of the application, under APPROOT, that contains the physical file.
See Defining and Allocating WebFOCUS Files for details on platform-specific commands.
ON TABLE HOLD FORMAT ALPHA as textfile
where:
Is the name of the file. The name can be from 1 to 8 characters.
-HTMLFORM valuespg
where:
Is the name of the launch page.
!IBI.FIL.textfile;
or
<!--WEBFOCUS TABLE textfile-->
where:
Is the name of the file that contains the values.
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.
Note that the text file is allocated dynamically in memory and has no fixed length limit.
The Reporting Server must be able to locate the launch page using APP PATH or EDAPATH. See Choosing Search Path Logic for details on search paths.
This example runs on WebFOCUS for Windows. If you are using another platform, substitute the appropriate platform-specific command for the FILEDEF command. For information on the FILEDEF command and where to store the files created in this example, see Defining and Allocating WebFOCUS Files.
Procedure: DYNAMMUL.FEX
FILEDEF DYNAMLST DISK BASEAPP/DYNAMLST.TXT DEFINE FILE SHORT OPTCOUNTRY/A40 = '<option>'|COUNTRY; END TABLE FILE SHORT SUM OPTCOUNTRY BY COUNTRY NOPRINT ON TABLE HOLD FORMAT ALPHA AS DYNAMLST END -RUN -HTMLFORM DYNAMIC2 -RUN
The sample launch page uses the Servlet.
Launch Page: DYNAMIC2.HTM
<HTML> <TITLE> DYNAMIC DROP-DOWN LIST REPORT </TITLE> <H4> PROJECTED RETURN BY COUNTRY </H4> <FORM ACTION="/ibi_apps/WFServlet" METHOD="GET"> <INPUT TYPE="HIDDEN" NAME="IBIF_ex" VALUE="MULRPT"> <SELECT NAME="COUNTRY" SIZE="3" MULTIPLE> <!--WEBFOCUS TABLE DYNAMLST--> </SELECT> <BR><BR><INPUT TYPE="SUBMIT" VALUE="RUN REPORT!"></FORM> </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.
Procedure: MULRPT.FEX
-SET &COUNTER=1; TABLE FILE SHORT SUM PROJECTED_RETURN BY COUNTRY -IF &COUNTRY.EXISTS THEN GOTO LOOP1 ELSE GOTO DONE; -LOOP1 WHERE COUNTRY EQ '&COUNTRY' -IF &COUNTRY0.EXISTS NE 1 THEN GOTO OUTLOOP; -REPEAT OUTLOOP FOR &COUNTER FROM 2 TO &COUNTRY0; OR '&COUNTRY.&COUNTER' -OUTLOOP -DONE ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF,$ ENDSTYLE END
Note: At run time, &COUNTRY0 contains the number of countries selected in the multiselect drop-down list. For example, if three countries are selected, &COUNTRY0 is set to 3, &COUNTRY and &COUNTRY1 are set to the first country selected, &COUNTRY2 is set to the second country selected, and &COUNTRY3 is set to the third country selected.
This example is for WebFOCUS environment with the Amper Auto-prompting feature not enabled (WF Client config variable IBIF_wfdescribe=OFF). For more information on the configuration parameter IBIF_wfdescribe, see the TIBCO WebFOCUS® Security and Administration manual.
If environment has the Amper Auto-prompting feature enabled, the following parameter can be added to the form to turn off the Amper Auto-prompting feature for the request being submitted from this form.
<INPUT TYPE="HIDDEN" NAME="IBIF_wfdescribe" VALUE="OFF"> add the above line to example file DYNAMIC2.HTM after line <FORM ACTION="/ibi_apps/WFServlet" METHOD="GET">
A page similar to the following displays: