IBM Books

Net.Data Reference Guide


Implicit Table Variables

These variables are defined by Net.Data and only recognized in REPORT and ROW blocks unless noted otherwise. Use these variables to reference values returned from your queries.

N_columnName

Purpose


AIX HP-UX OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X

The name of the specified column name. Valid in REPORT and ROW blocks.

Examples

Example 1:

%REPORT{
<P>Send e-mail to <a href="mailto:$(N_email)">$(N_name)</a>.
%}

Nn

Purpose


AIX HP-UX OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X

Contains the column name returned by a function call or query for column n. Valid in a REPORT and ROW blocks.

Examples

Example 1:

The name of column 2 is $(N2).

Example 2: This example shows how you can use this variable outside the REPORT block by using DTW_ASSIGN. For more information, see DTW_ASSIGN.

...
%ROW{
 @DTW_ASSIGN(col1, N1)
%}
 
%HTML(report){
@
Column 1 was $(col1).
%}

Example 3:

%REPORT{
<H2>Product directory</H2>
<TABLE BORDER=1 CELLPADDING=3>
<TR><TD>$(N1)</TD><TD>$(N2)</TD><TD>$(N5)</TD>
%ROW{
<TR><TD>$(V1)</TD><TD>$(V2)</TD><TD>$(V3)</TD>
%}
</TABLE>
Found $(ROW_NUM) models matching your description.
%}

NLIST

Purpose


AIX HP-UX OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X

Contains all the column names from the result of a function call or query. The default separator is a null, which runs all the column names together, but you can specify another separator in a DEFINE statement or block with a list variable or set ALIGN="YES" to use the space character as a separator. See ALIGN for more information.

Examples

Example 1: The list of column names uses a space between column names with ALIGN set to YES.

%DEFINE ALIGN="YES"
%REPORT{
Your query was on these columns: $(NLIST).
%}

Example 2: This example uses a %LIST variable to change the separator to " | ".

%DEFINE %LIST " | " NLIST
%REPORT{
Your query was on these columns: $(NLIST).
%}
 

NUM_COLUMNS

Purpose


AIX HP-UX OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X

The number of columns returned by a function call or query.

Examples

Example 1:

%REPORT{
Your query result has $(NUM_COLUMNS) columns: $(NLIST).
%}

RETURN_CODE

Purpose


AIX HP-UX OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X

The return code from a function call or query. Net.Data uses this value to process MESSAGE blocks. You can use this variable to determine whether a function call succeeded or failed. A value of zero indicates successful completion of a function call.

The RETURN_CODE variable can be found in these contexts:

Examples

Example 1: The application user sees a message stating whether the function completed successfully.

@function1()
%IF ("$(RETURN_CODE)" == "0")
 The function completed successfully.
%ELSE
The function failed with the return code $(RETURN_CODE).
%ENDIF

Example 2: If a function returns a return code other than 0, the default message is displayed.

%MESSAGE{
default: "<h2>Net.Data received return code: $(RETURN_CODE)</h2>" : continue
%}

ROW_NUM

Purpose


AIX HP-UX OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X

ROW_NUM is valid only within a ROW block and it is a counter that gets incremented until the last row is processed. For example, if there are 100 rows in a table, and you have set RPT_MAX_ROWS to 20, the final value of ROW_NUM is 20 because it was the last row processed.

Examples

Example 1:

%REPORT{
<TABLE BORDER=1>
<TR><TD> Row Number </TD> <TD> Customer </TD>
%ROW{
<TR><TD> $(ROW_NUM) </TD> <TD> $(V_custname) </TD>
%}
</TABLE>
%}

TOTAL_ROWS

Purpose


AIX HP-UX OS/2 OS/390 OS/400 SCO SUN Win NT




X


The total number of rows a query returns, no matter what the value of RPT_MAX_ROWS. For example, if RPT_MAX_ROWS is set to display a maximum of 20 rows, but the query returns 100 rows otherwise, this variable is set to 100 after ROW processing. You must set DTW_SET_TOTAL_ROWS to YES to use this variable. See DTW_SET_TOTAL_ROWS for more information.

Examples

%DEFINE DTW_SET_TOTAL_ROWS="YES"
 
%REPORT{
<H2>E-mail directory</H2>
<UL>
%ROW{
<LI>Name: <a href="mailto:$(V1)">$(V2)</a><BR>
Location: $(V3)
%}
</UL>
Names displayed: $(ROW_NUM)<BR>
Names found: $(TOTAL_ROWS)
%}

V_columnName

Purpose


AIX HP-UX OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X

The value for the specified column name for the current row and is only valid in the ROW block. The variable does not exist for undefined column names. A query containing two column names with the same name gives unpredictable results. Consider using an AS clause in your SQL to rename duplicate column names.

Examples

You have selected $(V_destcity).

Vn

Purpose


AIX HP-UX OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X

Contains field values for each row returned by a function call or SQL query for fields 1 through n. This variable is recognized only in a ROW block. To use it outside the block, use DTW_ASSIGN.

Examples

Example 1: This REPORT block displays an HTML table. The second column shows the e-mail address. You can send the person a message by clicking on the link.

%REPORT{
<H2>E-mail directory</H2>
<TABLE BORDER=1 CELLPADDING=3>
<TR><TD>Name</TD><TD>E-mail address</TD><TD>Location</TD>
%ROW{
<TR><TD>$(V1)</TD>
<TD><a href="mailto:$(V2)">$(V2)</a></TD>
<TD>$(V3)</TD>
%}
</TABLE>
Found $(ROW_NUM) models matching your description.
%}

VLIST

Purpose


AIX HP-UX OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X

Contains all the field values for the current row being processed in a ROW block and is only valid in a ROW block. The default separator is a null, which runs all the values together, but you can specify another separator in a DEFINE statement or block with a list variable or set ALIGN="YES" to use the space character as a separator. See ALIGN for more information.

The field values for each row of a table returned by a function call or query. The default separator is a space, but you can specify another separator in a DEFINE block or statement with a list variable.

Examples

Example 1:

%DEFINE ALIGN="YES"
 
%REPORT{
Here are the results of your query:
<OL>
%ROW{
<LI>$(VLIST)
%}
</OL>
%}
 

Example 2: This example uses a LIST variable to change the separator to <P>.

%DEFINE %LIST "<P>" VLIST
 
%REPORT{
Here are the results of your query:
%ROW{
<HR>$(VLIST)
%}
%}


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]