Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example displays working with a dashboard data source and its container. After starting the example the following operations are executed:
The first dimension of dashboard data source is returned.
Identifier, key, name and number of data source dimension changes are determined.
Identifier, key and name of dashboard dimension.
It is determined whether dimension is unique and is linked to data source object.
A dictionary with data source settings, based on which a data source object with new identifier value in dashboard is created.
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 data source dimension container
SPPLDashboardDataSourceDimensionObjects dimensionObjects1 =
m_dashboardReport->dataSourceDimensionObjects();
if (dimensionObjects1 != NULL) {
// Create a dictionary with data source dimension container
SNMutableArray objectDescriptions = dimensionObjects1->generatePlist()->qClass<NMutableArray>();
if (objectDescriptions->count() > 0) {
// Get first data source dimension
SPPLDashboardDataSourceDimensionObject dimensionObject1 =
[self getDimensionObjectFromObjects: objectDescriptions ByIndex:0];
// Create a dictionary with data source dimension settings
SNMutableDictionary plist1 = dimensionObject1->generatePlist()->qClass<NMutableDictionary>();
// Set new identifier value for the first data source dimension
plist1->setObjectForKey(NNumber::numberWithInt(5), NStr("changeCounter"));
// Create a second data source object based on dictionary
SPPLDashboardDataSourceDimensionObject dimensionObject2 =
PPLDashboardDataSourceDimensionObject::dimensionObject(plist1, m_dashboardReport->dataSourceObjects());
// Display information about this dimension
[self showDimensionObjectInfo: dimensionObject2];
}
}
}
// Returns data source dimension by index
-(SPPLDashboardDataSourceDimensionObject) getDimensionObjectFromObjects: (SNArray)objectDescriptions
ByIndex: (int) index {
// Get data source dimension
SPPLDashboardDataSourceDimensionObjects dimensionObjects =
PPLDashboardDataSourceDimensionObjects::dimensionObjects(
objectDescriptions,
m_dashboardReport->dataSourceObjects());
// Get data source dimension by index
SNString dimensionObjectId = dimensionObjects->objects()->objectAtIndex(index)->qClass<PPLDashboardDataSourceDimensionObject>()->dashboardRelatedId();
SNString dataSourceObjectId = m_dashboardReport->dataSourceObjects()->objects()->
objectAtIndex(index)->qClass<PPLDashboardDataSourceObject>()->dashboardRelatedId();
return dimensionObjects->getDimensionObject(dimensionObjectId, dataSourceObjectId);
}
// Displays information about data source dimension
-(void)showDimensionObjectInfo: (SPPLDashboardDataSourceDimensionObject) dimensionObject {
printf("Dimension identifier in data source: %s \n", dimensionObject->id()->UTF8String());
printf("Dimension key in data source: %lld \n", dimensionObject->key());
printf("Dimension name in data source: %s \n", dimensionObject->name()->UTF8String());
printf("Number of dimension changes in data source: %lld \n", dimensionObject->changeCounter());
printf("Data source identifier in dashboard: %s \n",
dimensionObject->dashboardRelatedId()->UTF8String());
printf("Data source dimension key in dashboard: %lld \n",
dimensionObject->dashboardRelatedKey());
printf("Data source dimension name in dashboard: %s \n",
dimensionObject->dashboardRelatedName()->UTF8String());
// Check if data source dimension is unique
if(dimensionObject->isOriginal()) {
printf("Data source dimension is unique\n");
} else {
printf("Data source dimension is not unique\n");
}
// Get data source object
SPPLDashboardDataSourceObject dataSourceObject =
dimensionObject->dataSourceObject();
// Check if dimension is linked to data source object
if(dimensionObject->isLinkedDSO()) {
// Get linked data source object
SPPLDashboardDataSourceObject dataSourceObject =
dimensionObject->dataSourceObject();
printf("Dimension is linked to data source object %s \n", dataSourceObject->id()->UTF8String());
} else {
printf("Dimension is not linked to data source object %s \n", dataSourceObject->id()->UTF8String());
}
}
After executing the example the development environment console displays information on the first dimension of dashboard data source:
Dimension identifier in data source: FACTS_98
Dimension key in data source: 98
Dimension name in data source: Facts
Number of dimension changes in data source: 5
Data source dimension identifier in dashboard: DIMITEM
Data source dimension key in dashboard: 1
Data source dimension name in dashboard: Facts
Data source dimension is unique
Dimension is not linked to data source object OBJ9630
See also: