Skip to content

List Customers Drill Down Report

This page is going to show you how to create the Customer Drill Down web report. This report is a customer report that allows you to "drill down" into the details of each customer record.

Creating the Customer Drill Down Report

  1. Click on the Create New button on the Studio’s toolbar.
  2. Click on the Web Object tab of the Create New... dialog.
  3. Double-click the WBO Report Wizard icon.

  4. Read the explanations on the first wizard page of what this wizard will do and click Next.

  5. On the Names wizard page, enter CustomerDrillDownReport as the object name, CustomerDrillDownReport as the filename, and Customer Drill Down Report as the description. Then click Next.

  6. On the "Main Data Dictionary" wizard page, click on Customer - Customer_DataDictionary to select it as the data dictionary to be used, then click Next.

  7. On the "Entry Fields" wizard page, add columns Customer_Number, Name, Phone_Number, Balance, and Status from the Customer table, then click Next.

  8. On the Index wizard page, leave the default selection of Create index combo - design time control selected and click Next.

  9. On the "Selection Fields" wizard page, add column Customer.Customer_Number and click Next.

  10. On the "Records per Page / Drill Down Report" wizard page, leave the default (50) as the number of records per page and click Next.

  11. On the "Drill Down" wizard page, leave Customer.Customer_Number selected in the combo form. Also, leave the default Create a new zoom page radio selected. Click Next.

  12. On the "Zoom page fields" page, add all columns from the Customer table, then remove Status.

  13. On the "Style sheet options" wizard page, simply accept the default Cascading Style Sheet (CSS) and click Next.

  14. Click Finish on the last wizard page.

You should now be back in the Studio, with the outline of the newly created CustomerDrillDownReport.wo and CustomerDrillDownReport.asp pages open in the Code Editor.

Testing the Completed Report

  1. Click on the Run button on the Studio's toolbar. The Studio will compile, then run your project. When the application runs, your browser should display the testcontent.htm page.

  2. Click on the Customer Drill Down Report link.

  3. Click on the Run Report button.

  4. You can click the Next Page link to see the next 10 records in the report. You can click the New Report link to reset the report. If you click on any of the hyperlinks in the Number column, you will see the "Customer Drill Down Report (Zoom)" page.

  5. Close your browser to return to the Studio.

Customizing the Customer Drill Down Report

You will now add a minor customization to the Customer Drill Down Report. Right now, you can only click on the Number column of the report to drill down to the zoom page. Since this column is often narrow and not that easy to click on, you are going to allow the user to click on the Customer Name column as well to drill down to the zoom page.

  1. In the Code Explorer view of CustomerDrillDownReport.wo, expand the tree view to the oReport object. Expand it, too, and double-click on OnBody to display its code in the code editor.

  2. Scroll down in Procedure OnBody until the block of code between Send WriteHtmlRowBegin and Send WriteHtmlRowEnd is displayed in Code Explorer. Take a look at this code:

    Send WriteHtmlRowBegin
    Get AddRowIdLink (FormatNumber (sCustomerCustomer_Number,0)) To sText
    Send WriteHtmlCell sText 'class="Data" align="right"'
    Send WriteHtmlCell sCustomerName 'class="Data" align="left"'
    Send WriteHtmlCell sCustomerPhone_Number 'class="Data" align="left"'
    Send WriteHtmlCell (FormatNumber (sCustomerBalance,2)) 'class="Data" align="right"'
    Send WriteHtmlCell sCustomerStatus 'class="Data" align="left"'
    Send WriteHtmlRowEnd
    

This is the block of code that writes out each record in the Customer Drill Down Report. The first line inside the block (Get AddRowLink...) is the line of code that creates a link to the zoom page from the Customer.Customer_Number field.

To create a link from the Customer.Name field, you need to apply the same code to this field as is applied to the Customer.Customer_Number field. Some minor differences to keep in mind are: since the customer name is an ASCII field, you do not need to call the FormatNumber function and it will be left-aligned.

  1. Change the block of code to this:

    Send WriteHtmlRowBegin
    Get AddRowIdLink (FormatNumber (sCustomerCustomer_Number,0)) To sText
    Send WriteHtmlCell sText 'class="Data" align="right"'
    Get AddRowIdLink sCustomerName To sText
    Send WriteHtmlCell sText 'class="Data" align="left"'
    Send WriteHtmlCell sCustomerName 'class="Data" align="left"'
    Send WriteHtmlCell sCustomerPhone_Number 'class="Data" align="left"'
    Send WriteHtmlCell (FormatNumber (sCustomerBalance,2)) 'class="Data" align="right"'
    Send WriteHtmlCell sCustomerStatus 'class="Data" align="left"'
    Send WriteHtmlRowEnd
    
  2. So, let's test the report with this change. Click on the Run button on the Studio's toolbar. The Studio will compile, then run your project. When the application runs, your browser should display the testcontent.htm page. Click on the Customer Drill Down Report link.

  3. Click on the Run Report button. As you will see, you can now click on the Customer Name column, as well as the Number column to drill down to the zoom page (test it if you'd like).

  4. Close your browser to return to the Studio.

Next Step

List Orders Drill Down Report