Displaying Records in Tables
When HTML procedures are activated, all positioning values in the SQR program are ignored. Thus, the position values cannot be used to display records in a tabular format. To display records in a tabular format, use the following procedures:
| Description | Beginning Procedure | End Procedure |
|---|---|---|
|
Create a table. |
html_table |
html_table_end |
|
Create a caption. The end is typically implied and html_caption_end is not required, but you can use it for completeness. |
html_caption |
html_caption_end |
|
Create rows. The end is typically implied and html_tr_end is not required, but you can use it for completeness. |
html_tr |
html_tr_end |
|
Create column headings. The end is typically implied and html_th_end is not required, but you can use it for completeness. |
html_th |
html_th_end |
|
Create columns. The end is typically implied and html_td_end is not required, but you can use it for completeness. |
html_td |
html_td_end |
The following sample program uses these table procedures to display information in a tabular format:
Program ex28a.sqr
#include 'html.inc'
begin-program
do main
end-program
! set a large page length to prevent page breaks
begin-setup
declare-layout default
max-lines=750
end-declare
end-setup
begin-procedure main
! turn on HTML procedures
do html_on
! start the table and display the column headings
do html_table('border')
do html_caption('')
print 'Customer Records' (1,1)
do html_tr('')
do html_th('')
print 'Cust No' (+1,1)
do html_th('')
print 'Name' (,10)
! display each record
begin-select
do html_tr('')
do html_td('')
cust_num (1,1,6) edit 099999
do html_td('')
name (1,10,25)
next-listing skiplines=1 need=1
from customers
end-select
! end the table
do html_table_end
end-procedure