Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example describes creating an some methods of working with data source dimension. After starting the example the following operations are executed:
A data source is created based on description of the repository object obtained from selected dimension.
A dimension object is retrieved from data source by selected dimension identifier.
Name and text description of obtained dimension are retrieved.
Data aggregation mode value is changed.
Information about the repository object, based on which a data is created, is retrieved.
Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Data Analysis section):
// Get array of cube dimensions SNArray allDimensions = [self allDimensions]; // Get first cube dimension in array SPPLDimension dimension = allDimensions->objectAtIndex<PPLDimension>(0); // Get description of the object, based on which the current dimension is created SPPLMetabaseRepositoryObjectDescriptor dimensionObjectDescriptor = dimension->relatedObjectDescriptor(); // Create a data source by means of repository object description SPPLDataSource createdDataSource = PPLDataSource::dataSource(dimensionObjectDescriptor); // Get dimension object from created data source by current dimension identifier SPPLDimension dataSourceDimension = createdDataSource->dimensionById(dimension->id()); // Get name of the dimension retrieved from data source SNString dataSourceDimensionName = dataSourceDimension->name(); // Display name of the dimension retrieved from data source in the development environment console printf("Data source dimension: \"%s\"\n", dataSourceDimensionName->UTF8String()); // Get current aggregation mode value bool dataSourceIsAggregate = createdDataSource->isAggregate(); // Set new value of current data aggregation mode that is opposite to source value createdDataSource->setIsAggregate(!dataSourceIsAggregate); // Get changed value of current data aggregation mode dataSourceIsAggregate = createdDataSource->isAggregate(); // Display data aggregation mode value in the development environment console if(dataSourceIsAggregate) printf("Source data aggregation mode is enabled\n"); else printf("Source data aggregation mode is disabled\n"); // Get data source description SPPLMetabaseRepositoryObjectDescriptor dataSourceDescriptor = createdDataSource->descriptor(); // Get name of the repository object, based on which data source is created SNString dataSourceDescriptorName = dataSourceDescriptor->name(); // Display name of the repository object, based on which data source is created, in the development environment console printf("Name of the repository object, based on which data source is created: %s\n", dataSourceDescriptorName->UTF8String()); // Get text description of dimension retrieved from data source SNString dataSourceDimensionDescription = dataSourceDimension->description(); // Display text description of dimension retrieved from data source in the development environment console printf("Description of dimension retrieved from data source:\n\n%s\n", dataSourceDimensionDescription->UTF8String());
After executing the example the development environment console displays name and description of the dimension retrieved from data source, name of the repository object, based on which data source is created, and also value of source data aggregation mode:
Data source dimension: "Calendar"
Source data aggregation mode is enabled
Name of the repository object, based on which data source is created: World Development Indicators
Description of dimension retrieved from data source:
id: CALENDAR_Y_ENG_533
name: Calendar
Elements tree:
Elements count: 11
See also: