Here is OLAPTimeDimension to the rescue. It can be introduced as any other dimension in the OLAPCube schema and then configured to return year, half year, quarter, month and day in any combination.
<mx:OLAPCube id="salesCube" > <mx:OLAPDimension name="SalesData" > <mx:OLAPAttribute name="Company" dataField="company" /> <mx:OLAPAttribute name="Region" dataField="region" /> <mx:OLAPAttribute name="Market" dataField="market" /> <mx:OLAPAttribute name="Product" dataField="product" /> <mx:OLAPHierarchy name="Region-Market-Store" > <mx:OLAPLevel attributeName="Company" /> <mx:OLAPLevel attributeName="Region" /> <mx:OLAPLevel attributeName="Market" /> <mx:OLAPLevel attributeName="Product" /> </mx:OLAPHierarchy> </mx:OLAPDimension> <local:OLAPTimeDimension name="Years" dataField="date" /> <mx:OLAPMeasure name="Revenue" dataField="revenue" /> </mx:OLAPCube>
Using this we get the following result where in we can query revenue for different years.
It can be easily extended to query quarters and months by setting includeQuarter and includeMonth to true on OLAPTimeDimension. The source is here.
6 comments:
When I create a flex application in Flex Builder and paste the code for OLAPDemo3.mxml and OLAPDemo4.mxml, I get an error:
1180: Call to a possibly undefined method progress.
..at the line:
private var pbar:progress = new progress;
Of course, OLAPTimeDimension.as is present in the same folder as the mxml files.
The progress.mxml file.
I see progress only inside cubeCompleteHandler.
Is it possible to get the progress messages even for query execution just like we see for cube building?
I am delaying the pbar.closeWindow
until olapResultHandler but I dont see any progress messages after
var token:AsyncToken = cube.execute(query);
If you have registered a event listener for CubeEvent.QUERY_PROGRESS you should get the progress of query execution. Let me know if that isn't the case.
Hi
I am facing a problem regarding Olap Datagrid creation onload of page. I am having dynamic data and query and cube is like the olap datagrid developed by you.
TypeError: Error #1009: Cannot access a property or method of a null object reference
at mx.olap::CubeNodeBuilder/findNodeWithOneCell()
at mx.olap:: CubeNodeBuilder/optimizeCube()
I am using Version no 3.0.0.47 of datavisualization.swc
I need to use this version only(no latest version).
I will appreciate your help.
Thanks
Post a Comment