Manually editing Report Builder queries
Before you begin
About this task
When you create a report, Report Builder generates the underlying query resource. If you are using the data warehouse as the data source, an SQL query is generated. If you are using Lifecycle Query Engine (LQE), a SPARQL query is generated.
You can see the query in the text editor in the Advanced section. When you create a report and then make changes using the guided graphical Report Builder interface, the generated query is automatically updated, and it is read-only.
- Application data related columns: These describe the data in terms that are familiar to each Collaborative Lifecycle Management (CLM) application.
- Data warehouse operational datastore mapping: This identifies where the data coming from the CLM application is being stored in the data warehouse. Report Builder creates queries that run against this data warehouse.
Because the ability to manually edit the report queries is advanced functionality, and not all users are familiar with SQL or SPARQL query syntax, an administrator can specify that only report managers can edit the generated queries. See Limiting manual query editing to report managers.
Procedure
Manually adding columns
In the following example, Rational Data Warehouse is the data source. You start with the basic report on work items, and add a column for work item tags to the SQL query.
Before you begin
Procedure
- Expand the Advanced section in Report
Builder. The
generated SQL query looks like this:
- Click Edit query.
- The items under SELECT are the columns currently defined for the report. To add a column for tags, insert a line above that last SELECT item (T1.URL) and add the following statement: T1.TAGS as Tags,.
- Click Validate Query. The generated SQL query looks like this: Note that the new column is included in the list in the My Choices pane.
Adding dynamic filters
For SQL, template parameters are defined by a string that is within dollar signs ($), such as $Priority$. This string defines a text parameter for priority that will be substituted into the query at run time, based on what the user enters when they click the lock on the dashboard. When they run the report, the filters list includes Priority.
In the following example, Rational Data Warehouse is the data source. You start with the basic report on work items that includes columns for Complexity and Creation Date, and add a dynamic filter for Priority to the SQL query.
Procedure
- Expand the Advanced section in Report
Builder. The
generated SQL query looks like this: When you run the report, you see these dynamic filters:
- Click Edit query.
- To add a dynamic filter for priority, under the WHERE statement, insert a line after the first item (T1.PROJECT_ID = 1), and add the following lines: AND and T1.REQUEST_PRIORITY='$Priority$'.
- Click Validate Query. The generated SQL query looks like this: When you run the report, you see the new dynamic filter:
Limiting manual query editing to report managers
Before you begin
Procedure
- Open Report Builder, and click Admin and then click Data Sources: https://server_name:port/rs/endpoint
- On the Data Sources page, click a data source name in the list.
- In the Data source properties section, enable the Restrict
query editing to report managers check box, and then click
Save.
- Optional: Repeat these steps for each data source.