Skip to content

Reporting Documentation

biren34 edited this page Dec 9, 2014 · 3 revisions

Custom Report with Parameters

The format of the parameter is {Field Name:field_type}.

You can have spaces in the field name, but no special characters. There are 3 field types currently implemented:

  • app
    • App dropdown that only lets users select from valid apps in your org
  • date
    • Date picker
  • text
    • Text box

You have to use one of these 3 values, lowercase only.

Whatever gets entered gets replaced exactly, so the custom report SQL should handle the quoting appropriately. Usually, parameters are used in WHERE clauses, so here's an example of what that might look like:

WHERE app='{App:app}'
AND local_datetime::DATE >= '{First Date:date}'
AND kingdom = '{Kingdom:text}'
AND country IN ({Country List:text})

Note that the single quotes appear around the app, date and kingdom fields, but not around the country list. This is because each value listed in the IN clause would need to be quoted, so it has to be entered that way by the user. It's usually good to give a default string in the description for people to copy and paste in this case, like 'AU','CA','US'.

HTML tags can be used in the description field. Best practice is to use unordered lists to provide instructions in bullet points. Also, it is a good idea to start your SQL with a comment line the repeats the title like so:

-- Custom Report that does awesome thing
SELECT * FROM...

That way, whenever the report is run, the title appears in the SQL Query history, which enables users to find the custom report among other results.

Clone this wiki locally