| 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
connectionMicroStrategy connection object
report_idIdentifier of a report.
parallelIf TRUE, downloads report data asynchronously. FALSE by default.
nameReport name.
attributesReport attributes.
metricsReport metrics
attr_elementsReport attribute elements.
selected_attributesAttributes selected for filtering.
selected_metricsMetrics selected for filtering.
selected_attr_elementsAttribute elements selected for filtering.
dataframeDataframe containing data fetched from the Report.
cross_tabboolean for filtering cross tabbed reports logic
cross_tab_filtersview filters for cross tab reports
instance_idIdentifier 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
connectionMicroStrategy connection object. See Connection class.
report_idIdentifier of a pre-existing report containing the required data.
instance_idIdentifier 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.
callbackused 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
limitHow many rows of data to fetch per request.
verboseIf TRUE, displays list of attribute elements.
Method clone()
The objects of this class are cloneable with this method.
Usage
Report$clone(deep = FALSE)
Arguments
deepWhether 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)