Tuesday, June 10, 2008

CalculatedMeasures in Flex OLAP

I wrote a small sample which shows how a Custom Aggregator can be written and used to simulate a Calculated measure in Flex OLAP. Of-course, this solution may not work for all requirements but can be used atleast in some scenarios. The source is here.

7 comments:

bkelley said...

Hi, I am new to Flex; Do you know if there is a way to configure AdvancedDataGrid so that when someone opens a new folder, the previously open folders close? I have a complex datagrid, and I would like users to be able to just have one major category folder open at a time? Thoughts? thanks. Brian

Sreenivas said...

You need to make sure that only the latest opened node remains in the ADG.dataProvider.openNodes property. I would try listening to the itemOpening or itemOpen event and set openNodes to empty.

JT_008 said...

Hi Sreenivas,

I have an AdvancedDataGrid that gets data from an an hierachical XML.


<:AdvancedDataGrid id="MyADG" height="100%" sortableColumns =
"false" source="{new HierarchicalData(MyXML)}>


MyXML is hierarchical (location->department->sub department->revenue).
I am trying to create summary rows (for location, dept, sub dept) and
all the examples I see (including your blog examples) talk about getting Flat data, creating
grouping collection, group fields and then summary fields.


Since my data is already hierarchical and grouped , do I still have to
group them to create summary fields? I guess the real question is -
Does Hierarchical data structure has any advantages when compared to
Flat structure, when it comes to creating summary fields? I want to
avoid grouping if it is not needed.


Is there an example that uses hierarchical data and creates summary
fields?


Thanks a bunch!

Sreenivas said...

Unfortunately summary for hierarchical data is not supported out of the box. The reason being the following.

When users supply flat data in a Collection and perform grouping a new set of Collections are created for each parent and object references copied over to the new Collections.

Due to this, Flex now has access to a new Collection which can be modified without affecting the source collection. The summaries are computed and added to these collections.

For any other form of data (read hierarchical) it is difficult to achieve this without creating duplicate collections at some point of time.

You may want to tweak/combine code from HierarchicalCollectionView and GroupingCollection and try to achive this if you have time to spare for this activity.

JT_008 said...

thanks!

Rahul Singh said...

Hi Sreenivas,
Is there a way to take this further and link data in an OLAP grid directly to a Chart?

Rahul

Sreenivas said...

Take a look at http://flexmadeeasy.blogspot.com. This has a OLAPChart component within the PivotComponent.