3 Replies Latest reply on Nov 15, 2007 12:05 PM by jfizer

    Programatic creation of OLAP Levels?

    jfizer

      While I can create an OLAP Level in Action Script. It seems a fruitless endeavor due to that fact that all the attributes of the object are read only.

      var myOlapDim2Level1:OLAPLevel = new OLAPLevel();
      myOlapDim2Level1.name = "Product";

      This creates an OLAPLevel object, no problems there.

      myOlapDim2Level1.dataField = "product";

      This however fails due to the dataField being read only. Same is true of the attribute property. So there seems to be no means of assigning a data field to a OLAP Level created in action script.

      Anyone have any ideas?
        • 1. Re: Programatic creation of OLAP Levels?
          Sreenivas R Adobe Employee
          The only property which needs to be set for a OLAPLevel is the attributeName.

          OLAPLevel gets associated with the OLAPAttribute object with that name. The dataField property of the OLAPAttribute would be used by the OLAPLevel.

          OLAPHierarchy should be made up OLAPLevel objects which are associated with OLAPAttribute already defined.
          • 2. Programatic creation of OLAP Levels?
            jfizer Level 1
            quote:

            OLAPLevel gets associated with the OLAPAttribute object with that name. The dataField property of the OLAPAttribute would be used by the OLAPLevel.


            So the following should just work then? Without having to assign the attribute to the level?

            //Create dimension 1
            var myDimension1:OLAPDimension = new OLAPDimension("CustomerDim", "Customer");
            //Create hierarchy for dimension 1
            var myHierarchy1:OLAPHierarchy = new OLAPHierarchy("CustomerHier", "Custmer");
            myHierarchy1.hasAll = true;
            myHierarchy1.allMemberName = "(All)";
            //Create the levels
            var myOlapAttribute1:OLAPAttribute = new OLAPAttribute("Customer");
            myOlapAttribute1.dataField="customer";
            var myOlapDim1Level1:OLAPLevel = new OLAPLevel("Customer");
            myOlapDim1Level1.attributeName="Customer";
            //assign hierarchy & levels to dimension 1
            myHierarchy1.levels = new ArrayCollection([myOlapDim1Level1]);
            myDimension1.hierarchies = new ArrayCollection([myHierarchy1]);

            I've tried this, and while it compiles I dont seem to be getting any data in the datagrid and chart. Its acting like it did before I added the levels and attributes (empty dimensions). So I feel I'm still missing something.

            In fact, the query is failing on the cube when I try to pull out the attribute of the dimension.
            • 3. Re: Programatic creation of OLAP Levels?
              jfizer Level 1
              I figured it out, had a few errors and typos but its working now. Thanks.