Creating a Parametric Title

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example displays creating a parametric title with and without specifying of calendar dimension element.

Source Code

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 view controller
MAExpressAnalysisReportViewController *contr = (MAExpressAnalysisReportViewController *)m_controller;
// Get express report delegate
EAReportDelegateImpl *delegate = [contr delegate];
// Get map data source
MapDataViewDatasource *mapDatasource = (MapDataViewDatasource*)[delegate mapDatasource];
// Get pivot object for building data tables
SPPLPivot pivot = PPLPivot::pivot([delegate olapReport]);
// Create a map parametric title
MADataViewDatasourceTitleUtils *titleUtils = [[MADataViewDatasourceTitleUtils alloc] initWithPivot:pivot type:kDVDTMap];
NSLog(@"Parametric title without specifying of calendar dimension element: '%@'", [titleUtils title]);
// Get timeline keys
NSArray *timeAxisKeys = (NSArray *)[mapDatasource valueForKey:@"m_timeAxisKeys"];
if([timeAxisKeys count] > 0) {
    int64 key = [(NSNumber *)[timeAxisKeys objectAtIndex: 0] longValue];
    // Refresh title
    [titleUtils update];
    NSLog(@"Title with calendar dimension element: '%@'", [titleUtils titleWithCalendarElementKey: key]);
    NSLog(@"Title without calendar dimension: '%@'", [titleUtils titleWithoutCalendarElementKey]);
}

After executing the example the development environment console displays parametric title with and without specifying of calendar dimension element, and also title without calendar dimension:

Parametric title without specifying of calendar dimension element: "&[Dimensions.CALENDAR_Y_ENG_533]"

Title with calendar dimension element: "1990"

Title without calendar dimension: ""

See also:

Examples of Component Use