If you are authoring a Web page, you can create an HTML link that results in the execution of an HTML block. When a user at a browser clicks on a text or image that is defined as an HTML link, Net.Data executes the HTML block within the macro.
To create an HTML link, use the HTML <a> tag. Decide which text or graphic you want to use as your hyperlink to the Net.Data macro, then surround it by the <a> and </a> tags. In the HREF attribute of the <a> tag, specify the macro and the HTML block.
The following example shows a link that results in the execution of an SQL query when a user selects the text "List all monitors" on a Web page.
<a href="http://server/cgi-bin/db2www/listA.d2w/report"> List all monitors</a>
Clicking on the link calls a macro named listA.d2w, which has an HTML block named "report", as in the following example:
%DEFINE DATABASE="MNS97" %FUNCTION(DTW_SQL) myQuery(){ SELECT MODNO, COST, DESCRIP FROM EQPTABLE WHERE TYPE='MONITOR' %} %HTML(report){ @myQuery() %}
The query returns a table that contains model number, cost, and description information for each monitor that is described within the EQPTABLE table. This example displays the results of the query by generating a default report. See Report Blocks for information on how you can customize your reports using a REPORT block.