Building a custom report within Kentico is a very simple process. Leveraging many of Kentico’s features, companies can quickly create and design reports specific to their business/industry. Reports can be generated using any data within the database with ease and customized/branded to match a company’s look/feel.
For this tutorial, I will create a report to show the number of emails sent by the site each day for a given date range.
Notes:
- This particular report is dependent on the Kentico site being configured to retain sent emails long enough to accommodate the report parameters.
- This report will use a stored procedure that will need to be created in the Kentico database prior to running.
Step 1
Log into the CMS Desk and click the Reporting Module under the Tools tab.
Step 2
Click “New report category” to create a new category for your company’s reports. Enter the category name / code name.
Step 3
Click “New report” and enter the report name/code name
Note:
- Check “Allow public users to see this report” only if you are going to display this report on your public site to “non-logged” in users.
Step 4
Click “Add” under the “Graphs” section to add a graph to the report and enter the following information:
Notes:
- The "Query" field will contain the stored procedure name you created. This could also be a simple SQL query to return data.
- The “X-axis angle” has been rotated to display the dates vertically.
- The “Query” contains 2 parameters for the stored procedure which we will create in the next step.
Step 5
Click “Insert” to add the graph to the report and add labels to the display the report title and the dates searched.
Note:
- I’ve added the current site and report parameters (via macros) to display above the graph.
Step 6
Click on the “Parameters” tab and create the following parameters:
Name: dtStartDate
Attribute type: Date and time
Field caption: Start Date
Field type: Calendar
Name: dtEndDate
Attribute type: Date and time
Field caption: End Date
Field type: Calendar
Step 7
Click on the “View” and enter dates to run your report.
That’s it! You’ve created a custom report for your users to see how many emails were sent on a given date. The data returned by the "Query" is what drives the report. This value returns the data used in the graph/pie/table and can be any valid SQL statement. Additionally, reports can be customized with your company name/logo, as well as CMSContext values to further enhance the end result.