register log on
Knowledge base

Implement drill-down to a web form

KB Artcile # 2659
This walk-through shows how to implement a solution which displays a report (Product report) and then allows to drill down to a web form displaying editable details (Product properties) of the selected record. The report has a hyperlink column, which is set up to invoke a form and pass ProductID corresponding to the record selected by user clicking on the hyperlink. The form has a built-in query to get the record by ProductID and display it, as well as provide the possibility to edit and save changes. 

To optimize the work flow, the form has a hyperlink "Back to Report", which returns the user to the same page of the parent report, from where the user navigated to the form. No programming is necessary to implement the above-described scenario, the solution-specific part of the report needs to be configured, and a report query needs to be provided for the form to read and update the selected record.

First let's look at the report:

The hyperlink is enabled on the column properties page (column ProductNumber):

To access hyperlink request properties, click on the hyperlink edit icon on the column properties page:

On the hyperlink properties page, the hyperlink feature should be enabled, the request type should be set to HTTP Redirect (client side or server side), and the request target should specify web service API which invokes the form. Optionally, to pass security context to  the report, property Session Token may need to be checked.  As a design choice, property Open in New Window may be checked to display the form on a new web page, otherwise the form is presented on the same page as the output from the report. 

Below is the complete content of the Request Target property, which includes the web service API call to the form. (Note: before using the code below, please unwrap the entire URI into a single line, eliminating line breaks, which were added in this article for readability):

The web service call to the form is a simple URI, which specifies execution of the FormServer service LoadFormPage against the DEMO7AWProductEdit report, passing product identifier via parameter ProductID.

The other parameters in this web service call specify the following (these parameters are optional and they are added in this solution to demonstrate additional capabilities which may enhance end user experience):

  • IsPromptPageEnabled - specifies that the form should not generate prompt page displaying the value of ProductID, which it uses as a record identifier. With value 0 passed to the form, the value of product identifier is read from the URI query string, merged with the query and form generates its output with record details immediately without displaying the prompt page
  • ReportContextToken - specifies a reference to the instance of the report, which the form will use when a user clicks on the "Back to Report" hyperlink
  • ReportPageNumber - specifies a reference to the page number of the report to be opened, when a user clicks on the "Back to Report" hyperlink

This is what the form looks like:

The form has form items defined by designer for each data field presented on the form:

The form item ProductID was set up as read-only, it initializes its value automatically from the URI query string parameter ProductID and maintains the record identity for the entire life of the form instance:

Other form items, ReportContextToken and ReportPageNumber, which reference report instance identifier and report return page number are initialized with the following expressions accordingly:



Form item CustomerID is used in database query action, which is executed before form is loaded, and is used in SQL query to read data from the corresponding record:

A complete SQL statement, with form item included in the evaluatable expression is:

  ph.productphotoid, as ProductSubcategoryName, as ProductCategoryName
  Production.Product pt
  production.productproductphoto ppp on ppp.productid = pt.productid
  production.productphoto ph on ph.productphotoid = ppp.productphotoid
  production.productsubcategory sb on sb.productsubcategoryid = pt.productsubcategoryid
  production.productcategory ct on ct.productcategoryid = sb.productcategoryid

    (pt.Productid = <%iif(oServer.oSystem.IsEmptyOrNull(oData.oFormItem.Productid), '0', oData.oFormItem.Productid)%>)

The final modification which is to be done on the form is to display a hyperlink leading to the the same page of the report, from where request to the form was made.

The hyperlink to the report may be placed in different parts of the form; in this solution, it was added to the far-right side of the form toolbar row in line with the Save and Reset button. Form toolbar items can be managed from the form properties page:

Image below shows configuration of the request on toolbar item properties page; this request is triggered when user clicks on "Back to Report" hyperlink. The request uses web service API call to the same report instance, from which the current instance of the form was created. The API call is implemented as HTTP rediect (client-side or server-side).

Toolbar item attribute string property accepts inline CSS to specify the right-aligned position of the hyperlink.

Because redirecting to the report does not require engaging a full form submit cycle (as opposed to typical cases of processing form "Submit" or "Save" requests), the request sequence type was set as "Process request, disable actions".