Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example describes some methods of working with express report delegate. After starting the example the following operations are executed:
An express report delegate is created and retrieved.
An express report is retrieved from the obtained delegate.
Express report access permissions are retrieved.
An express report access permission object is created based on a bit mask.
A dictionary containing express report initial settings is retrieved.
It is checked if express report contains a screenshot.
An express report is saved to favorites.
Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Displaying of Express Report section):
// Get express report delegate instance EAReportDelegateImpl *reportDelegate = (EAReportDelegateImpl *)[m_controller delegate]; // Get express report SPPLOlapReport report = [reportDelegate olapReport]; // Display initial mode of express report data display in the development environment console NSLog(@"Initial mode of express report data display: %@", report->startMode()->nsString()); // Get express report access permissions MAReportAccessRights *rights = [reportDelegate accessRights]; // Display express report access permissions in the development environment console NSLog(@"Express report access permissions:"); NSLog(@"Read: %@", [rights canRead]? @"allowed": @"denied"); NSLog(@"Write: %@", [rights canWrite]? @"allowed": @"denied"); NSLog(@"Delete: %@", [rights canDelete]? @"allowed": @"denied"); NSLog(@"Print: %@", [rights canPrint]? @"allowed": @"denied"); // Create a new object of express report access permissions based on a bit mask MAReportAccessRights *rights2 = [[MAReportAccessRights alloc] initWithBitmask:[rights bitmask]]; // Compare the new object with the express report access permission object and display comparison result in the development environment console if([rights isEqual: rights2]) { NSLog(@"Compare new express report access permission object with the initial object: objects are equal"); } else{ NSLog(@"Compare new express report access permission object with the initial object: objects are not equal"); } // Get a dictionary containing report initial settings NSDictionary *settings = [reportDelegate reportSettings]; // Get a dictionary containing chart initial settings NSDictionary *chart = [settings valueForKey:@"chart"]; // Get array of keys of chart settings dictionary NSArray *settingsKeys = [chart allKeys]; // Display chart parameters in the development environment console NSLog(@"Chart parameters contained in dictionary:" ); // Parse keys of chart settings dictionary in cycle for(NSString *key in settingsKeys) { // Display chart settings parameter name and value in the development environment console NSLog(@"%@: %@", key, [chart valueForKey:key]); } // Check if there is screenshot and display check result in the development environment console NSLog(@"Screenshot existence: %@", [reportDelegate hasScreenshot]? @"exists":@"does not exist"); // Get repository link SPPLMetabase metabase = PPLMetabase::sharedMetabase(report->descriptor()->repositoryDescriptor()); // Display the number of favorite repository objects before adding the report to favorites in the development environment console NSLog(@"Number of favorite repository objects before adding the report to favorites: %d",metabase->favoriteDescriptors()->count()); // Save report to favorites [reportDelegate saveFavoriteWithName:@"favorite1"]; // Display the number of favorite repository objects after adding the report to favorites in the development environment console NSLog(@"Number of favorite repository objects after adding the report to favorites: %d",metabase->favoriteDescriptors()->count());
It is also required to replace the code fragment in the static example file MAExpressAnalysisReportViewControllerFactory.mm in the createReport: method before the string:
SNString plistPath = PPLFileManager::getReportPlistPath(olapReport->descriptor());
with the following code:
// Create a report delegate EAReportDelegateImpl *delegate = [[[EAReportDelegateImpl alloc] initWithOlapReport:olapReport] autorelease]; // Create a dashboard controller MAExpressAnalysisReportViewController *report = [[[MAExpressAnalysisReportViewController alloc] initWithDelegate:delegate] autorelease]; // Set dashboard controller for the created delegate delegate.expressReportController = report;
After executing the example the development environment console displays information about express report, express report chart setting parameters, result of comparison of a new express report access permission object with the source object, and also the number of favorite repository objects before and after adding the express report to favorites:
Initial mode of express report data display: Table
Express report access permissions:
Read: allowed
Write: allowed
Delete: allowed
Print: allowed
Comparison of a new express report access permission object with the source object: objects are not equal
Chart parameters contained in the dictionary:
legendOrientation: 3
chartType: 0
legendVisible: true
Screenshot existence: missing
Number of favorite repository objects before adding the report to favorites: 0
Number of favorite repository objects after adding the report to favorites: 1
See also: