Providing user-defined range values for a ReportMate report

One common need is to send the range values for a ReportMate report to the request that will be running the report.  This may be sent as part of the information provided from a hyperlink or as information provided from an HTML form.  Assuming you already have the ReportMate report defined, here's an overview of how you get the data to it from a NetLink page:

When you send the hyperlink string or form variables NetLink will see which variables are needed to run the ReportMate and extract the values of those variables to pass to ReportMate.  ReportMate will then use the values as if they had been keyed in at runtime.

Example 1 - Sending Range Values in a Hyperlink

In this mode you are calling a NetLink request via a hyperlink from a previous page.  The request has to run one or more ReportMate reports to extract data, and these reports need some ranges or selection criteria passed to them.

Let's assume you are running a report that has a range of customer numbers and a range of dates.  You want to create a hypertext link that runs the report for the current customer who is logged in and for a range of dates that includes the last 90 days.

  • In the NetLink RM parameters for the report specify that:
    • the variable for the beginning of the customer range is "CUST_NO"
    • the variable for the ending of the customer range is also "CUST_NO"
    • the variable for the beginning of the date range is "DATE_START"
    • the variable for the ending of the date range is "DATE_END"
  • In the page that contains the hyperlink to run this report you must use a ReportMate report to provide the calculated values for DATE_START (the current date minus 90 days) and DATE_END (the current date).  
  • The link in the template should contain the variables that will be replaced with the current info each time the link is displayed:
    <a href="http://@var_form_action_url_@?request_id=myreport&cust_no=@var_cust_no_@&date_start=@var_date_start_@&date_end=@var_date_end_@"> linkname </a>

    For example, if customer 1289 used this link on June 30, 2002 the resulting URL might be:
    <a href=""> linkname </a>
  • When the user clicks on the link the URL executes NetLink, NetLink passes the appropriate values for the customer range and date range to ReportMate, and ReportMate runs the report.
Sample Link with variables to be passed to ReportMate

You can cut/paste this into a template and edit for the appropriate request ID and variable names.


Example 2 - Sending Range Values from a Form

In this mode you are calling from an HTML form to a NetLink request that runs one or more ReportMate formats to extract data.    This is typically needed when you want to give the user options of what request to run or range values to supply and don't or can't provide pre-built links for every possible option.  The information in the form includes some or all of the ranges or selection criteria needed by ReportMate.

An example like this in the standard NetLink examples is the request ID "CINVRNG" which allows a customer to enter a range of invoice numbers and a range of invoice dates as parameters for an invoice history listing.  The template "nlcinvrg.htm" includes a form with:

  •  hidden fields that the user does not see but that are required to call the next request (such as CUST_NO and REQUEST_ID)
  • visible fields to accept the range values from the customer

@VAR_INCLUDE_HTML=header.txt_@ @VAR_INCLUDE_HTML=custhdr.txt_@

Edit Range of Invoice Numbers (default is ALL) Start
Edit Range of Invoice Dates (default is ALL) Start


Each field on the form is given a name that will match up with names assigned to the various parameters the ReportMate report will need:

  • INVNO_START is the variable for the beginning invoice number
  • INVNO_END is the variable for the ending invoice number
  • INV_DATE_START is the variable for the beginning invoice date
  • INV_DATE_END is the variable for the ending invoice date

Note that the form provides defaults for this ranges.  You should always provide defaults when possible to reduce the chance that the user will submit invalid data and not get the results they expect.

When the user submits the form all the variables in the form are sent to NetLink, NetLink matches the variable names up with the range values ReportMate needs, and ReportMate runs using the ranges submitted.

Sample Page for Two Ranges in a Form (from request CINVRNG, file nlcinvrg.htm)

You may cut/paste this HTML into a page and edit the request ID, hidden variables, and range field variable names as needed.  (In the standard SouthWare template there is some additional validation inserted via FrontPage that has been removed in this example.)