Cell Element (MDDataSet)
TOC
Collapse the table of content
Expand the table of content

Cell Element (MDDataSet) (XMLA)

 

Applies To: SQL Server 2016 Preview

Contains information about a single cell contained by a parent CellData element.

  
<CellData>  
   <Cell CellOrdinal="unsignedInt">  
      <!-- Zero or more cell property values -->  
      <!-- or -->  
      <Error>...</Error>  
   </Cell>  
</CellData>  

CharacteristicDescription
Data type and lengthNone
Default valueNone
Cardinality0-n: Optional element that can occur more than once.
RelationshipElement
Parent elementsCellData
Child elementsZero or more cell property values or Error
AttributeDescription
CellOrdinalRequired unsignedInt attribute. The ordinal position of the cell within the multidimensional dataset.

In the parent root element, the Axes element is followed by the CellData element, a collection of Cell elements that contain the property values for each cell returned in the multidimensional dataset. The Cell element contains the CellOrdinal attribute, which indicates the zero-based ordinal position of the cell within the multidimensional dataset, and one element for each cell property value associated with the cell. Each cell property value in the Cell element is defined by a separate XML element. The value of the cell property is the data contained by the XML element, and the name of the cell property, as defined in the CellInfo element of the parent root element, corresponds to the name of the XML element.

The following syntax describes a cell property value:

<CellProperty xsi:type="string">value</CellProperty>  

The data type of a cell property value is specified only for the VALUE cell property. The data types of other cell properties are determined by the cell property definition included in the CellInfo element. A cell property value element can be excluded if a default value has been specified (by including a Default element for a cell property definition contained in the CellInfo element) for a cell property, or if no default value has been specified and the value of the cell property is null.

If a cell property cannot be returned due to an error that occurs on the instance of Microsoft SQL Server Analysis Services, such as a calculation error that prevents the value from being returned for a given cell, an Error element replaces the contents of the cell property in question. The following XML example describes a cell property error:

<Cell CellOrdinal="0">  
   <Value xsi:type="xsd:double">  
      <Error>  
         <ErrorCode>2148497527</ErrorCode>  
         <Description>Unknown error</Description>  
      </Error>  
   </Value>  
</Cell>  

The axis reference for a cell can be calculated based on a CellOrdinal attribute value. Conceptually, cells are numbered in a dataset as if the dataset were a p-dimensional array, where p is the number of axes. Cells are addressed in row-major order.

Suppose that a query requests four measures on columns and a crossjoin of two states with four quarters on rows. In following the dataset result, the CellOrdinal property for the part of the dataset result shown in bold text is the set {9, 10, 11, 13, 14, 15, 17, 18, 19}. This is the set because the cells are numbered in row-major order, starting with a CellOrdinal of 0 for the upper left cell.

StateQuarterUnit salesStore costStore salesSales count
CaliforniaQ11689014431.0936175.25498
Q21805215332.0238396.755915
Q31837015672.8339394.056014
Q42143618094.545201.847015
OregonQ11928716081.0740170.296184
Q21507912678.9631772.884799
Q31694014273.7835880.465432
Q41635313738.6834453.445196
WashingtonQ13011425240.0863282.869906
Q22947924953.2562496.649654
Q33053825958.2664997.3810007
Q43423529172.7273016.3411217

Applying the formula shown in the figure, axis k = 0 has Uk = 4 members, and axis k = 1 has Uk = 8 tuples. P = 2 is the total number of axes in the query. Taking the cell that is {California, Q3, Store Cost} as S0, the initial summation is i = 0 to 1. For i = 0, the tuple ordinal on axis 0 of {Store Cost} is 1. For i = 1, the tuple ordinal of {CA, Q3} is 2.

For i = 0, Ei = 1, so for i = 0 the sum is 1 * 1 = 1 and for i = 1, the sum is 2 (tuple ordinal) times 4 (the value of Ei computed as 1 * 4), or 8. The sum of 1 + 8 is then 9, the cell ordinal for that cell.

The following example demonstrates the structure of the Cell element, including the VALUE, FORMATTED_VALUE, and FORMAT_STRING cell property values for each cell.

<CellData>  
   <Cell CellOrdinal="0">  
      <Value xsi:type="xsd:double">16890</Value>  
      <FmtValue>16,890.00</FmtValue>  
      <FormatString>Standard</FormatString>  
   </Cell>  
   <Cell CellOrdinal="1">  
      <Value xsi:type="xsd:int">50</Value>  
      <FmtValue>50</FmtValue>  
      <FormatString>Standard</FormatString>  
   </Cell>  
   <Cell CellOrdinal="2">  
      <Value xsi:type="xsd:double">36175.2</Value>  
      <FmtValue>$36,175.20</FmtValue>  
      <FormatString>Currency</FormatString>  
   </Cell>  
</CellData>  

MDDataSet Data Type (XMLA)
Properties (XMLA)

Community Additions

ADD
Show:
© 2016 Microsoft