The following example shows a macro that calls a REXX function to generate a Net.Data table that has two columns and three rows. Following the call to the REXX function, a built-in function, DTW_TB_TABLE(), is called to generate an HTML table that is sent back to the browser.
%DEFINE myTable = %TABLE
%DEFINE DTW_DEFAULT_REPORT = "NO"
%FUNCTION(DTW_REXX) genTable(out out_table) {
out_table_ROWS = 3
out_table_COLS = 2
/* Set Column Headings */
do j=1 to out_table_COLS
out_table_N.j = 'COL'j
end
/* Set the fields in the row */
do i = 1 to out_table_ROWS
do j = 1 to out_table_COLS
out_table_V.i.j = '[' i j ']'
end
end
%}
%HTML(REPORT) {
@genTable(myTable)
@DTW_TB_TABLE(myTable)
%}
Results:
COL1 COL2 [ 1 1 ] [ 1 2 ] [ 2 1 ] [ 2 2 ] [ 3 1 ] [ 3 2 ]