Reusing report queries in data sets

You can reuse existing queries from Cognos® Analytics reports by copying either individual queries or entire report specifications into data sets.

The data set and the report from which you copy the queries must be based on the same type of data source, either a data module or a package.

When you copy an individual report query, you add the query to the data set, and can continue working with the data set.

When you copy the report specification, the data set is overwritten and you can use the query (or queries) from the report in the data set. The report layout is not copied. The data set is renamed to the default New data set. You can then save it as a new data set.

Procedure

  1. Create or open an existing data set.
  2. From Team content or My content, open the Cognos Analytics report in the edit mode.
  3. Use the following steps to copy an individual query into your data set:
    1. In the report, from the Report menu, click Queries to open the report Queries view.
    2. Right-click the query that you want to copy, and click Copy.
    3. Go back to the data set, and from the Data set menu, click Queries.
    4. Right-click anywhere in the empty space in the Queries view, and click Paste. The new query is added to the view.
    5. Save the data set.
  4. Use the following steps to copy the report specification:
    1. From any page in the report, click the More icon Context menu, and select Copy report to clipboard.
    2. Go back to the data set, click the More icon Context menu, and select Open report from clipboard.
    3. Paste the report specification into the empty box that is displayed, and click OK.

      You are back in the data set list view. The data source and the query in the data set were replaced. The data set name is shown as New data set, even if you started with a data set named differently.

    4. Open the Queries view. All queries from the report are copied into the data set.
    5. Save the data set using the Save as option.
  5. From the Data set menu, click Pages > Page1. You are back in the data set list view.
  6. Click the Reset button to break the list association with the previous query.

    The data items are removed from the list. You can now add data items from a different query, including the copied report queries, to the list.

  7. In the Insertable objects pane, click the Data items tab Data item icon.

    The report queries and their data items are shown in the tab.

  8. Drag items from one query to the data set list.
  9. Save the data set.

Results

Here is an example of the Queries view after a query labeled Report query was copied into the data set. The report query was joined with a preexisting query labeled Initial query.

Example of copying report queries

Later, the data items from the Joined query were used to populate the list in the data set.

Example of copying report queries