uthtmsel.wbb - Generate HTML List from a BBx Or PRO/5 SELECT Verb

Syntax

CALL "uthtmsel.wbb",fl$, where$, sortby$, opt$, maxrec, skip, count, tpl$,text$,work$,linkexpr$

Description

This high-level program simplifies the process of producing an HTML listing of records from a single file, using the BBx/PRO/5 SELECT verb. It supports a maximum record count and skip record count to control the resulting HTML record set.

Parameter

Description

fl$

Text string that contains the name of the file to issue the SELECT from.

where$

Text string that contains the optional WHERE clause (without the word "WHERE") for use in the SELECT statement.

sortby$

Text string that contains the optional SORTBY clause (without the word "SORTBY") for use in the SELECT statement.

opt$

Text string used in the SELECT statement's MODE="opt" clause. A common use of opt$ would be to control the optimization performed by BBx or PRO/5, such as "opt=nosort".

maxrec

Maximum number of records to include in the HTML output.

skip

Number of records to skip before including records in the HTML output. Because the SELECT statement does not provide a reliable means of starting a list at a specific point in the file, scrolling applications must know how far the previous page had read through the file. This variable is typically transferred in a "more records" URL. It is automatically incremented by the number of records read or returns 0 if the end of the SELECT is reached.

count

Returns the actual number of records included in the HTML output.

tpl$

Data template that reads records from the file indicated by chan.

text$

String variable that contains the HTML format for each record, along with embedded data name tags. For each record, the program "uthtmout.wbb" is CALLed, using this as the format text. See uthtmout.wbb for additional information.

work$

Returns the HTML text for the records. The global string $list also contains this value.

linkexpr$

Text string used by "uthtmout.wbb" to generate any href links from the records to another page. See uthtmout.wbb for additional information.

Automatic Pagination Support

If the skip argument is null, the cgi$ variable bbweb_s is checked. If present, it is used as the starting point for the list. On exit, if more records are available, the program generates a global string (STBL) $moreurl that contains the full URL, with any cgi$ fields retained, and with bbweb_s incremented for the next page. This can be used in a hyperlink for a continuation:

{if $moreurl > ""}
<a href="[$moreurl]">More records&ldots;</a>
{end}
This feature assumes that the value of where$, sortby$, and opt$ will be duplicated between executions.