This documentation supports the 19.11 version of Remedy Smart Reporting, which is available only to BMC Helix subscribers (SaaS).
To view an earlier version, select the version from the Product version menu of the documentation at IT Service Management Suite .

Creating reports with advanced database functions by using Advanced Authoring

Use the Advanced Authoring option to create reports with complex database queries. You can use complex database functions that contain multiple parts (such as over, partition by, order by) in a single function. 

Important

  • You can use Advanced Authoring for MS SQL and Oracle databases only.
  • Advanced Authoring or Freehand SQL reports do not support User Prompts & Source Filters.

To use Advanced Authoring, you must have the Admin, Corp Writer, or Report Writer role.

To create a report using Advanced Authoring

  1. On the Remedy Smart Reporting Admin Console, click the + button, and select Report.
  2. In the New Report window:
    1. Enable Advanced Authoring.
    2. From the Author Method list, select Freehand SQL.
    3. From the Data Source list, select a data source.
    4. Click Create Analysis button at the bottom of the New Report window.
  3. To write complex queries, in the SQL Query editor, perform the following steps:
    1. Enter the SQL query for creating the report. For examples of complex queries, see the examples below.

    2. Click Validate.
    3. Click Save.

The calculation is available in an SQLFields  folder on the Data page, and the report data is displayed on the right.

Examples of how to execute complex database functions having multiple parts

The following examples show how you can execute complex functions by using the Advanced Authoring option.

Example 1

LAG(`Short_desc` , 1) over (partition by `Short_desc`  order by `Short_Desc`)

To run this function, enter the following query in the SQL Query editor:

SELECT DBFN('lag;over;partition by;order by', 4, '#KWD#(' , `Short Description` , 1 , '#KWD#)' , 1, '#KWD#(' , 1 , `Short Description` , 2 , `Short Description` , '#KWD#)') FROM 'AR System Schema'.'Test:Form'

The following table describes how to interpret the DBFN functionality:

ArgumentDescription
lag;over;partition by;order byIndicates all parts in the function.
4Indicates the number of arguments in the first part: (, Short_desc, 1, and )
The opening and closing brackets are prefixed with the string #KWD#, for example, #KWD#( or #KWD#).
1Indicates the number of arguments in the next part over, which has only one argument: ( which is prefixed by #KWD#.
1Indicates the number of arguments in the next part partition by, which has only one argument Short Description.
2Indicates the number of arguments in the next part order by, which has only two arguments: Short Description and ). The final closing bracket is prefixed as #KWD#).


The flow continues as shown in the table for all the arguments in a function that has multiple parts.

Example 2

RANK() over(order by COUNT(Incident_Number) desc) RANK

To run this function, enter the following query in the SQL Query editor:

SELECT DBFN('rank;over;order by count',2,'#KWD#(','#KWD#)',1,'#KWD#(',5,'#KWD#(',`Incident Number`,'#KWD#)','#KWD#desc','#KWD#)') RANK FROM 'AR System Schema'.'HPD:Help Desk'

The following table describes how to interpret the DBFN functionality:

ArgumentDescription
rank;over;order by;countIndicates all parts in the function.
2Indicates the number of arguments in the first part: (, and )
The opening and closing brackets are prefixed with the string #KWD#, for example, #KWD#( and #KWD#).
1Indicates the number of arguments in the next part over, which has only one argument: ( which is prefixed by #KWD#.
5Indicates the number of arguments in the next part order by count, which has 5 arguments (, Incident_Number, ), desc, and ). The opening and closing brackets are prefixed with the string #KWD#. For example, #KWD#( or #KWD#).


Was this page helpful? Yes No Submitting... Thank you

Comments