| AIX | HP-UX | Linux | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X | X |
The table variable defines a collection of related data. It contains a set of rows and columns including a row of column headers. Use table variables to pass groups of values to a function. You can refer to the individual elements of a table (the rows) in a REPORT block of a function or by using table built-in functions. Table variables are often used for output from an SQL function and input to a report, but you can also pass them as IN, OUT, or INOUT parameters to any non-SQL function. Tables can only be passed to SQL functions as OUT parameters. See TABLE Statement for syntax and more information.
When a TABLE variable is referenced, Net.Data displays the content of the table as either a plain character table, or as an HTML table if the DTW_HTML_TABLE variable is set to YES.
Example 1: A SQL result set that is passed to a REXX program
%DEFINE{
DATABASE = "iddata"
MyTable = %TABLE(ALL)
DTW_DEFAULT_REPORT = "NO"
%}
%FUNCTION(DTW_SQL) Query(OUT table) {
select * from survey
%}
%FUNCTION(DTW_REXX) showTable(INOUT table) {
Say 'Number of Rows: 'table_ROWS
Say 'Number of Columns: 'table_COLS
do j=1 to table_COLS
Say "Here are all of the values for column " table_N.j ":"
do i = 1 to table_ROWS
Say "<B>"i"</B>: " table_V.i.j
end
end
%}
%HTML (report){
<HTML>
<PRE>
@Query(MyTable)
<p>
@showTable(MyTable)
</PRE>
</HTML>
%}
The HTML REPORT block calls an SQL query, saves the result in a table variable and then passes the variable to a REXX function.