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
- Click on the Create New button on the Studio’s toolbar.
- Click on the Web Object tab of the Create New... dialog.
-
Double-click the WBO Report Wizard icon.
-
Read the explanations on the first wizard page of what this wizard will do and click Next.
-
On the Names wizard page, enter
CustomerDrillDownReportas the object name,CustomerDrillDownReportas the filename, andCustomer Drill Down Reportas the description. Then click Next. -
On the "Main Data Dictionary" wizard page, click on
Customer - Customer_DataDictionaryto select it as the data dictionary to be used, then click Next. -
On the "Entry Fields" wizard page, add columns
Customer_Number,Name,Phone_Number,Balance, andStatusfrom the Customer table, then click Next. -
On the Index wizard page, leave the default selection of Create index combo - design time control selected and click Next.
-
On the "Selection Fields" wizard page, add column
Customer.Customer_Numberand click Next. -
On the "Records per Page / Drill Down Report" wizard page, leave the default (50) as the number of records per page and click Next.
-
On the "Drill Down" wizard page, leave
Customer.Customer_Numberselected in the combo form. Also, leave the default Create a new zoom page radio selected. Click Next. -
On the "Zoom page fields" page, add all columns from the Customer table, then remove
Status. -
On the "Style sheet options" wizard page, simply accept the default Cascading Style Sheet (CSS) and click Next.
-
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
-
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.htmpage. -
Click on the Customer Drill Down Report link.
-
Click on the Run Report button.
-
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.
-
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.
-
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. -
Scroll down in Procedure OnBody until the block of code between
Send WriteHtmlRowBeginandSend WriteHtmlRowEndis 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.
-
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 -
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.htmpage. Click on the Customer Drill Down Report link. -
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).
-
Close your browser to return to the Studio.