You can create a link in a Web page that results in the execution of an HTML block by using the HTML <a> tag in the macro file. You accomplish this by using the HREF attribute to specify the macro and HTML block, and by including some text or even an image within the link tag. This method identifies the text or image as a "hot spot" when the Web page is displayed at the browser. When a user at a browser clicks on the text or image, Net.Data executes the HTML block within the macro.
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>
The link calls this macro:
%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.