CreateReport
Creates a custom report by providing dimensions and metrics.
Stored Procedure Specific Information
To create a report view on a query, you can use the CreateReport stored procedure. The CreateReport stored procedure provides an easy way to generate new view definitions with a custom combination of Dimensions and Metrics. Calling it will create a new schema file that you can query like any other view.
The stored procedure takes a view name, a comma-separated list of metric names, a comma-separated list of metric ids, a comma-separated list of dimension names, a comma-separated list of dimension ids and an output folder as inputs. You will need to set the Location connection property to the folder containing the new script files in order to access them; the Location can be set instead of the output folder.
You can get the metric/dimension Ids by querying Metrics/Dimensions views.
SELECT Id, Name FROM Dimensions SELECT Id, Name FROM Metrics
For example, to use a new schema along with the default schemas, set the Location property to the db subfolder in the installation folder and make the following call:
EXEC CreateReport DimensionIds = 'variables/geocountry, variables/geocity', MetricIds = 'metrics/pageviews, metrics/visits', TableName = 'MyCustomReport'Dimensions and Metrics should have their respective Ids specified in DimensionIds and MetricIds inputs.
Input
Name | Type | Required | Description |
TableName | String | True | The name for the new table. |
Description | String | False | An optional description for the table. |
WriteToFile | String | False | Wheather to write the contents of this stored procedure to a file or not (Default = true) needs to be set to false to output FileStream of FileData |
DimensionIds | String | True | A comma-separated list of dimensions' ids. |
MetricIds | String | True | A comma-separated list of metrics' ids. |
Result Set Columns
Name | Type | Description |
FileData | String | If the OutputFolder input is empty. |
Success | String | Whether or not the schema was created successfully. |
SchemaFile | String | The generated schema file. |