Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example displays working with table header elements. After starting the example the following operations are executed:
Top header of pivot object for building data tables is returned.
A new object of table top header is created.
The number of elements before and after their removal from table top header is determined.
Elements of table top header with the 1, 2 and 3 indexes are removed by various methods.
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 table left header SPPLPivotHeader topPivotHeader = m_gridPivot->topHeader(); // Get data source dimension selection SPPLDimensionSelectionSet selectionSet = m_gridPivot->selectionSet(); SPPLPivotTableHeaderElements pivotTableHeaderElements = new PPLPivotTableHeaderElements(topPivotHeader->dimensions(), selectionSet); printf("Initial number of elements: %d \n", pivotTableHeaderElements->elementsCount()); //SNMutableArray indexes = new NMutableArray(); for (int i = pivotTableHeaderElements->elementsCount() - 1; i >= 0; i--) { SPPLPivotTableHeaderElement element = pivotTableHeaderElements->getElementByIndex(i); switch (i) { case 1: // Remove element by index pivotTableHeaderElements->removeElementByIndex(i); break; case 2: // Remove element pivotTableHeaderElements->removeElement(element); break; case 3: // Remove element by array of indexes SNArray indexes = NArray::arrayWithObject(NNumber::numberWithInt(i)); pivotTableHeaderElements->removeElementsWithIndexes(indexes); break; } } printf("Remained number of elements: %d \n", pivotTableHeaderElements->elementsCount());
After executing the example the development environment console displays the number of table elements before and after their removal:
Initial number of elements: 6
Remained number of elements: 3
See also: