2 Replies Latest reply on Mar 13, 2008 2:49 AM by msnelsonUK

    OLAP data grid schema


      I can't find much documentation on how to create the olap schema programmatically in action script. I have tried but I am getting null referenced errors.

      Can anyone give me a guide on how to do this?


        • 1. Re: OLAP data grid schema
          Sreenivas R Adobe Employee
          Here is a sample code.

          private function createCube():void
          salesCube = new OLAPCube();

          var dim1:OLAPDimension = new OLAPDimension("SalesData");

          //add attributes to the dimension
          var attr1:OLAPAttribute = new OLAPAttribute("Region");
          attr1.dataField = "region";

          var attr2:OLAPAttribute = new OLAPAttribute("Market");
          attr2.dataField = "market";

          var attr3:OLAPAttribute = new OLAPAttribute("Store");
          attr3.dataField = "store";

          var attr4:OLAPAttribute = new OLAPAttribute("LineOfBusiness");
          attr4.dataField = "line_of_business";

          var attr5:OLAPAttribute = new OLAPAttribute("Model");
          attr5.dataField = "model";

          dim1.attributes = new ArrayCollection([ attr1, attr2, attr3, attr4, attr5 ]);

          //add a user defined hierarchy
          var regionHierarchy:OLAPHierarchy = new OLAPHierarchy("Region-Market-Store");

          //define the levels of the hierarchy
          var level1:OLAPLevel = new OLAPLevel();
          level1.attributeName = "Region" ;

          var level2:OLAPLevel = new OLAPLevel();
          level2.attributeName = "Market" ;

          var level3:OLAPLevel = new OLAPLevel();
          level3.attributeName = "Store" ;

          var level4:OLAPLevel = new OLAPLevel();
          level4.attributeName = "LineOfBusiness" ;

          var level5:OLAPLevel = new OLAPLevel();
          level5.attributeName = "Model" ;

          //add levels to the hierarchy
          regionHierarchy.levels = new ArrayCollection([ level1, level2, level3, level4, level5 ]);

          //add hierarchy to the dim
          dim1.hierarchies = new ArrayCollection([ regionHierarchy ]);

          //more dimensions can be defined here

          var measure:OLAPMeasure = new OLAPMeasure("Revenue");
          measure.dataField = "revenue" ;

          //more measures can be defined here

          //add the dimensions and measures to the cube.
          salesCube.elements = [ dim1, measure ];
          • 2. Re: OLAP data grid schema
            msnelsonUK Level 1

            I am on the same track but I don't explicitly add any hierarchies, levels or members to my cube. Plus I add the dimensions and attributes in a different manner. I suspect that I need to explicitly add hierarchies?

            I'm currently getting null reference error when it trys to getUniqueName() on an OLAPMember.

            Can you review my code and see any reasons why it doesn't work:

            private function createCube():void
            myOlapCube = new OLAPCube();
            var elementArray:Array = new Array();

            for each(var dimensionItem:Object in dimensionList)

            myOlapCube.elements = elementArray;

            myOlapCube.dataProvider = testList;

            private function addDimensionToCube(dimensionItem:Object):OLAPDimension
            var dimension:OLAPDimension;
            var attribute:OLAPAttribute;

            dimension = new OLAPDimension(dimensionItem.label+"Dim");

            attribute = new OLAPAttribute(dimensionItem.label);
            attribute.dataField = dimensionItem.label;

            return dimension;

            private function addMeasureToCube():OLAPMeasure
            var olapMeasure:OLAPMeasure = new OLAPMeasure(primaryMeasure);
            olapMeasure.dataField = primaryMeasure;
            return olapMeasure