(I am using C# 4.0. I am connecting to a data cube via the Microsoft.AnalysisServices.AdomdClient namespace/library.)
If I understand correctly there is exactly one axis in an MDX SELECT statement that will contain measures; the others will be based on the other dimensions.
My immediate task (the larger task is irrelevant, I believe) is given an MDX SELECT statement such that the first axis contains said measures, I need to programmatically determine the data type of the all of the cells pertaining to each of the measures.
One way to do this, I think, would be to use the AdomdConnection and reference the CubeDef class to obtain measure information, and match that to Cellset.Set.Tuples.Members sort of thing, but then how does one account for on-the-fly measures from using the "WITH" keyword in a SELECT?
Another way could be to look at the Value property of Cell objects associated with a given measure from executing the SELECT statement and find a non-null Cell in the CellSet, but we're not guaranteed to find a non-null value, so this is not fail-proof.
I've looked through a CellSet in the VS debugger and haven't found any properties that give this information.
Solution:
As it turns out, it is possible for a measure to have multiple data types. At least for measures defined with a WITH
clause, as follows:
WITH MEMBER [Measures].[Dud] AS CASE WHEN [Measures].[Original] > 500 THEN 'A' ELSE 0 END
Because of this, data type information is stored in each cell, and not in some sort of measures meta data. Subsequently, the only way to learn the schema is to assume that they're all the same type, and then traverse through the measures dimension until you find a non-null cell and then learn its type.