Skip to main content

Quick Start Guide

Getting Started

The examples below will use the following configuration:

  • The configured data source name is myDb
  • The database contains a table called user with columns:
    • user_id int
    • user_name varchar(255)
    • email varchar(255)

Test your database connection

Once you have configured your data source, test that it works. You can do this with a simple Report Info macro:

CODE
{report-info:config:myDb > text:is empty > boolean:fail/pass}

If the connection fails, you should either see an error message returned or you may need to check your log output.

Write your first report

Let's create a basic report with the raw data from our table. This will show us the equivalent of the following query:

SQL
select user_id as "User ID", 
	   user_name as "Username", 
       email as "Email" 
from user
  1. Create a Report Table macro
  2. In the body, create an SQL Reporter macro and set the data source parameter to myDb. In the body of the macro, you can enter "select * from user".
  3. Below the SQL Reporter, add three Report Column macros. In each case, check the "Injected" parameter. Set the title as the column names above. In the body, inject the column's value by using the key "%row:<column name>%". It should look just like the image below:
  4. Save the page. The output should look like this:

Get Fancy

The example above doesn't show any of the benefits of accessing SQL via the Reporting add-on. Let's look at some ways we can take advantage of it.

  • Change the email address to a link by wrapping it with a Report Link macro. Set the key to row:email (no "%" signs this time) and the prefix to "mailto:"
  • Add some scaffolding data to supplement your database. To do this, add a new Report Column with the Injected parameter checked. Inside the body, add a Text Data macro and set the key to "%row:user_name%-notes". Now you can add notes against each database record!
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.