Working with Synchronization Settings of Dashboard Dimensions

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example implements working with synchronization settings of dashboard dimensions. After starting the example the following operations are executed:

Source Code

Executing the example requires to place the following code instead of the executeExample method of the ViewController class (see the Displaying of Dashboard section):

-(void)executeExample {
    // Get first synchronization dimension
    SPPLDashboardSynchronizationDimension dimensionObject = [self getSynchronizationDimensionByIndex: 0];
    // Display information about dashboard synchronization dimension
    [self showSynchronizationDimensionInfo: dimensionObject];
}
// Returns synchronization dimension by index
-(SPPLDashboardSynchronizationDimension) getSynchronizationDimensionByIndex: (int) index {
    // Get dictionary with synchronization dimension container settings and create a container object on their basis
    SNArray dimensionDescriptions = m_dashboardReport->synchronizationDimensions()->generatePlist()->qClass<NArray>();
    SPPLDashboardSynchronizationDimensions dimensionObjects = PPLDashboardSynchronizationDimensions::synchronizationDimensions(dimensionDescriptions, m_dashboardReport->dataSourceDimensionObjects());
    // Get specified synchronization dimension
    SPPLDashboardSynchronizationDimension dimensionObject = dimensionObjects->dimensions()->objectAtIndex(index)->qClass<PPLDashboardSynchronizationDimension>();
    // Create a dictionary with first synchronization dimension settings
    SNMutableDictionary plist1 = dimensionObject->generatePlist()->qClass<NMutableDictionary>();
    // Set new attribute for first synchronization dimension
    plist1->setObjectForKey(NStr("testSyncAttr"), NStr("syncAttr"));
    // Create a second synchronization dimension object based on dictionary
    return PPLDashboardSynchronizationDimension::synchronizationDimension(plist1, m_dashboardReport->dataSourceDimensionObjects());
}
// Displays information about dashboard synchronization dimension
-(void)showSynchronizationDimensionInfo: (SPPLDashboardSynchronizationDimension) dimensionObject {
    printf("Synchronization dimension identifier: %s \n", dimensionObject->id()->UTF8String());
    printf("Synchronization dimension key: %lld \n", dimensionObject->key());
    printf("Synchronization dimension key: %s \n", dimensionObject->name()->UTF8String());
    printf("Synchronization attribute: %s \n", dimensionObject->syncAttribute()->UTF8String());
    printf("Synchronization index key: %lld \n", dimensionObject->syncIndexKey());
    SPPLDashboardDataSourceDimensionObject dimension = dimensionObject->dimensionObject();
    printf("Linked dimension key: %lld \n", dimension->key());
    printf("Linked dimension name: %s \n", dimension->name()->UTF8String());
}

After executing the example the development environment console displays information about the first dashboard synchronization dimension:

Synchronization dimension identifier: ITEM

Synchronization dimension key: 1

Synchronization dimension name: ITEM

Synchronization attribute: testSyncAttr

Synchronization index key: 1

Linked dimension key: 98

Linked dimension name: Facts

See also:

Example of pplib++ Library Use