5.2 On-line Catalog (catalog.nbt)

In the example below, for readability, some RES-Reach tags may span several lines on your browser page. This is not allowed in a real template file.

File: catalog.nbt

Comments

< HTML >

Again, this is ordinary HTML

< HEAD >

< TITLE >On-Line catalog< /TITLE >

< /HEAD >

< BODY >

< DATA SQL="SELECT * FROM PRODUCTS" DATABASE="{DB}" CONNECT="dBase III" MODE="READONLY" >

Execute this query on the dBASE file PRODUCTS.DBF in the directory pointed to by {DB} (from the INI file)

< RECORD >

Iterate this block for every record in the query, skip if no records.

< IF VARIABLE="{RecNo}" OPERATOR="EQ" COMPARISON="1" >

This block is only included for the first record.

< H1 >Items that match the search criteria< /H1 >

< TABLE BORDER >

Start the table

< CAPTION > < H4 >Enter quantity and select < b >ADD< /b > to add to your order.< /H4 >< /CAPTION >

with a caption

< TR >< TH >Item #< /TH >< TH >Description< /TH >< TH >Cost per unit< /TH >< TH >Quantity to order< /TH >< /TR >

and column headers

< /IF >

< FORM ACTION={Call_NBT} >

each row is a separate form

< INPUT TYPE=hidden NAME="NBT" Value="Order" >

The submit button calls ORDER.NBT

< INPUT TYPE=hidden NAME="Cust" Value="{Cust}" >

hidden field: Customer ID

< INPUT TYPE=hidden NAME="PO" Value="{PO}" >

hidden field: PO number

< INPUT TYPE=hidden NAME="Item" Value="{[ITEM_ID]}" >

hidden field: ITEM_ID database field for this record.

< INPUT TYPE=hidden NAME="PerUnit" Value="{[PER_UNIT]}" >

hidden field: (price) PER_UNIT database field for this record.

< TR >< TH >{[ITEM_ID]}< /TH >< TH >< B >{[DESCRIPT]}< /B >< /TH >< TH >${[PER_UNIT]}< /TH >< TH >

in each row, display fields ITEM_ID, DESCRIPT, PER_UNIT, and

< INPUT TYPE=text NAME="Qty" Size=4 Value="1" >< INPUT TYPE=submit VALUE="ADD" >< /TH >< /TR >

Editable field: Qty, default value "1", and a submit button with the label "ADD"

< /FORM >

end of form

< /RECORD >

move to the next record and repeat

< IF VARIABLE="{TotalRows}" OPERATOR="NE" COMPARISON="0" >

Past the last record. Were there any records?

< /TABLE >

If so, complete the table

< /IF >

< IF VARIABLE="{TotalRows}" OPERATOR="EQ" COMPARISON="0" >

If not,

< H1 >No Items Match< /H1 >

Table was never started,

Select "Back" and re-enter the search string, or send your request to our< A HREF="mailto:sales@myfirm.com" > account manager< /A >.

show a message.

< /IF >

 

< /DATA >

Close the query

< FORM ACTION={Call_NBT} >

Another form, another button!

< INPUT TYPE=hidden NAME="NBT" Value="Order" >

This one calls ORDER.NBT

< INPUT TYPE=hidden NAME="Cust" Value="{Cust}" >

Like before, customer ID

< INPUT TYPE=hidden NAME="PO" Value="{PO}" >

and PO number

< INPUT TYPE=hidden NAME="Qty" Value="0" >

but no item to add to PO

< INPUT TYPE=submit VALUE="Review Order" >< BR >

just to look at the PO again.

< /FORM >

< HR >

more ordinary HTML

< I >Thank you for using our on-line catalog. For other services, visit our < A HREF="home.htm" >home page< /A >< /I >

< /BODY >

< /HTML >