Adobe Flex 3 Data Visualization Developer Guide
// Event handler to execute the OLAP query
// after the cube completes initialization.
private function runQuery(event:CubeEvent):void {
// Get cube.
var cube:IOLAPCube = IOLAPCube(event.currentTarget);
// Create a query instance.
var query:IOLAPQuery = getQuery(cube);
// Execute the query.
var token:AsyncToken = cube.execute(query);
// Set up handlers for the query results.
token.addResponder(new AsyncResponder(showResult, showFault));
// Handle a query fault.
private function showFault(error:ErrorMessage, token:Object):void {;
// Handle a query success.
private function showResult(result:Object, token:Object):void {
if (!result) {"No results from query.");
myOLAPDG.dataProvider= result as OLAPResult;
<mx:OLAPCube name="FlatSchemaCube"
<mx:OLAPDataGrid id="myOLAPDG" width="100%" height="100%" />
Using the default member in a query
Many of the queries shown so far have referenced only two dimensions of the OLAP cube, such as ProductDim and
TimeDim. But what happens to the other dimensions when you omit them from the query?
All dimensions have a default member, either explicit or implicit. When you execute a query that does not reference
a dimension, the query aggregates the data for that dimension using the default member. For information on
defining the default member of a schema, see Creating a default member in a schema” on page 332.
Specifying a default cell string for the OLAPDataGrid control
When you define your query, you might create a situation where a cell of the OLAPDataGrid does not contain a
value. For example, when aggregating data by customer and product, you might have a customer that has never
purchased Illustrator. For that customer and product combination, the corresponding cell of the OLAPDataGrid
displays the String "NaN".
You can customize this String by setting the
OLAPDataGrid.defaultCellString. For example, if you want to set
the String to "No value", you would create an OLAPDataGrid control as shown here:
<mx:OLAPDataGrid id="myOLAPDG"

Get ADOBE® FLEX® 3: ADVANCED DATA VISUALIZATION DEVELOPER GUIDE now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.