Consultor Eletrônico



Kbase 20482: Creating Navigation Bars in/for WebSpeed Applications
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Unverified

GOAL:

How to create Navigation Bars in a WebSpeed Applications?

FIX:

The example takes the following steps. It:

1) Performs the query as stated in setQueryWhere(' ') based
against the database defined in setBuffers(' ') .

2) Assigns the returned records to a temp-table.

3) Generates an HTML table object to display the data within
using the table definition generated by setTableRows(n),
setTableModifier(' '), and setUseColumnLabels([yes
o]).

4) A navigation bar at the bottom of the table is created by HTML
form buttons. Their relatives values (First, Next, Previous,
Last) use getTableRows() to return the number of rows used in
the HTML table then submits the form to reposition the query
to the desired location.

(Reading the procedures fetchNext, fetchLast, and fetchPrev
shows more detail about the process for reopening the
query to the Next/Previous/Last set of records(Located in
wbtable.p.)

The Navbar.html is as follows:


<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta name="wsoptions" content="no-output">
<title>An Example of a navigation bar</title>

</head>
<body>
<center>

<!-- Report Title -->
<p><strong>The Sports' Customer List</strong><br><br></p>

<script language="SpeedScript">
DEFINE VARIABLE searchValue AS CHAR NO-UNDO.
DEFINE VARIABLE CurrentRowids AS CHAR NO-UNDO.
DEFINE VARIABLE TmpUrl AS CHAR NO-UNDO.
DEFINE VARIABLE DelimiterField AS CHAR NO-UNDO.

DEFINE VARIABLE UseNavigation AS LOG INIT yes NO-UNDO.
DEFINE VARIABLE UseSearchForm AS LOG INIT no NO-UNDO.
DEFINE VARIABLE DataObject AS CHAR INIT '' NO-UNDO.
DEFINE VARIABLE DataSourceHdl AS HANDLE NO-UNDO.

{src/web2/wbtable.i}


DO:
/** WebRep.p uses dynamic queries and buffers .
You can use user variables instead of hardcoded values. */
setBuffers('sports.Customer').
setQueryWhere('FOR EACH customer').
setExternalJoinList('').
setExternalWhereList('').
END.

/** You can use user variables instead of hardcoded values also for columns */
setColumns('Customer.Cust-Num,Customer.Name,Customer.City,Customer.State,Customer.Postal-Code').

/** Set the number of Rows per table */
setTableRows(10).

/** Set attributes for the <table> tag */
setTableModifier(' border="2"').

/** Use labels in the table */
setUseColumnLabels(no).

</script>

<form method="POST" name="SearchForm">
<input type="hidden" name="Navigate" value="Search">
</form>

<script language="SpeedScript">

/** ProcessWebReqest gets the value for Navigate and SearchValue, */
/** opens the query and outputs the table. */
RUN ProcessWebRequest.

ASSIGN
TmpUrl = url-format(?,getContextFields(),?)
Delimiterfield = IF INDEX(TmpUrl,"?") > 0
THEN ?
ELSE "?"
TmpUrl = TmpUrl + url-field("CurrentRowids":U,getCurrentRowids(),DelimiterField)
DelimiterField = IF INDEX(TmpUrl,"?") > 0
THEN ?
ELSE "?".

</script>
</center>

<div align="center"><center>
<table border="2">
<tr>
<td></td>
<td></td>
. <td></td>
<td></td>
</tr>
</table>
</center>

</div>

</body>
</html>

.