Report {mstrio}R Documentation

Extract a MicroStrategy report into a R Data.Frame

Description

Access, filter, publish, and extract data from in-memory reports. Create a Report object to load basic information on a report dataset. Specify subset of report to be fetched through Report$apply_filters() and Report$clear_filters() . Fetch dataset through Report$to_dataframe() method.

Public fields

connection

MicroStrategy connection object

report_id

Identifier of a report.

parallel

If TRUE, downloads report data asynchronously. FALSE by default.

name

Report name.

attributes

Report attributes.

metrics

Report metrics

attr_elements

Report attribute elements.

selected_attributes

Attributes selected for filtering.

selected_metrics

Metrics selected for filtering.

selected_attr_elements

Attribute elements selected for filtering.

dataframe

Dataframe containing data fetched from the Report.

cross_tab

boolean for filtering cross tabbed reports logic

cross_tab_filters

view filters for cross tab reports

instance_id

Identifier of an instance if report instance has been already initialized.

Methods

Public methods


Method new()

Initialize an instance of a report.

Usage
Report$new(connection, report_id, instance_id = NULL, parallel = FALSE)
Arguments
connection

MicroStrategy connection object. See Connection class.

report_id

Identifier of a pre-existing report containing the required data.

instance_id

Identifier of an instance if report instance has been already initialized, NULL by default.

parallel

(bool, optional): If True, utilize optimal number of threads to increase the download speed. If False (default), this feature will be disabled.


Method to_dataframe()

Extract contents of a Report into a R Data Frame.

Usage
Report$to_dataframe(limit = NULL, callback = function(x, y) {
})
Arguments
limit

(int, optional): Used to control data extraction behaviour on report with a large number of rows. By default the limit is calculated automatically. If TRUE, overrides automatic limit.

callback

used by the GUI to extract the progress information

Returns

Dataframe with data fetched from the given Report.


Method apply_filters()

Apply filters on the report data so only the chosen attributes, metrics, and attribute elements are retrieved from the Intelligence Server.

Usage
Report$apply_filters(
  attributes = NULL,
  metrics = NULL,
  attr_elements = NULL,
  operator = "In"
)
Arguments
attributes

(list or None, optional): ID numbers of attributes to be included in the filter. If list is empty, no attributes will be selected and metric data will be aggregated.

metrics

(list or None, optional): ID numbers of metrics to be included in the filter. If list is empty, no metrics will be selected.

attr_elements

(list or None, optional): Attributes' elements to be included in the filter.

operator

(character, optional): Supported view filter operators are either "In" or "NotIn". This defines whether data will include ("In") or exclude ("NotIn") the supplied attr_elements values.


Method clear_filters()

Clear previously set filters, allowing all attributes, metrics, and attribute elements to be retrieved.

Usage
Report$clear_filters()

Method get_attr_elements()

Load all attribute elements of the Report. Accessible via Report$attr_elements. Fetching attriubte elements will also allow for validating attriute elements by the filter object.

Usage
Report$get_attr_elements(limit = 50000, verbose = TRUE)
Arguments
limit

How many rows of data to fetch per request.

verbose

If TRUE, displays list of attribute elements.


Method clone()

The objects of this class are cloneable with this method.

Usage
Report$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

## Not run: 
# Create a connection object.
connection = Connection$new(base_url, username, password, project_name)

# Create a report object.
my_report <- Report$new(connection, report_id)

# See attributes and metrics in the report.
my_report$attributes
my_report$metrics
my_report$attr_elements

# Specify attributes and metrics (columns) to be fetched.
my_report$apply_filters(attributes = my_report$attributes[1:2],
                           metrics = my_report$metrics[1:2])

# See the selection of attributes, metrics and attribute elements.
my_report$selected_attributes
my_report$selected_metrics
my_report$selected_attr_elements

# Clear filtering to load a full dataset.
my_report$clear_filters()

# Fetch data from the Intelligence Server.
my_report$to_dataframe()

# See the dataframe.
my_report$dataframe

## End(Not run)

[Package mstrio version 11.3.5.101 Index]