1 Reply Latest reply on May 30, 2012 4:48 AM by Shripad_joshi

    Can I create other visualization components using OLAPResult from the OLAPQuery on a OLAPCube?

    Shripad_joshi

      Hi,

      I have a OLAPCube/ schema defined. I am executing a OLAPQuery on the Cube. With the result from the query execution, I can create OLAP Data Grid. But I want to know if I can draw any chart from the same result. If yes, then please let me know the way we can do so.

      Thank you...

        • 1. Re: Can I create other visualization components using OLAPResult from the OLAPQuery on a OLAPCube?
          Shripad_joshi Level 1

          /** Date:30-05-2012

                               * function decodes the OLAPResult object into arrayCollection and retruns

                               * the arrayCollection instance...

                               * */

                              public static function decodeOLAPResult(result:OLAPResult):ArrayCollection

                              {

                                        var colAxis:ArrayCollection = result.getAxis(OLAPQuery.COLUMN_AXIS).positions as ArrayCollection;

                                        var columnLength:Number = colAxis.length;

           

                                        var rowAxis:ArrayCollection = result.getAxis(OLAPQuery.ROW_AXIS).positions as ArrayCollection;

                                        var rowLength:Number = rowAxis.length;

                                        var newChartData:ArrayCollection = new ArrayCollection();

                                        var dataObject:Object;

           

                                        for(var j:int = 0; j < rowLength; j++)

                                        {

                                                  var row:OLAPAxisPosition = rowAxis[j];

                                                  var product:String = row.members.toArray().join(",");

                                                  if (product.indexOf("(All)") > -1) continue;

           

                                                  for (var i:int=0;i<columnLength;i++)

                                                  {

                                                            dataObject = new Object();

           

                                                            var tuple:OLAPAxisPosition = colAxis[i];

                                                            var period:String = tuple.members.toArray().join(",");

                                                            if (period.indexOf("(All)") > -1) continue;

           

                                                            for(var rowCount:int=0; rowCount < row.members.length; rowCount++)

                                                            {

                                                                      var fieldName:String = String(getFieldName(row.members[rowCount]).toLocaleLowerCase());

                                                                      dataObject[fieldName] = row.members[rowCount].name;

                                                            }

           

                                                            for(var colCount:int=0; colCount < tuple.members.length; colCount++)

                                                            {

                                                                      var field:String = String(getFieldName(tuple.members[colCount]).toLocaleLowerCase());

                                                                      dataObject[field] = tuple.members[colCount].name;

                                                            }

           

                                                            dataObject.revenue = result.getCell(j, i).value;

                                                            newChartData.addItem(dataObject);

                                                            //newChartData.push({dim1:dim1, dim2:dim2, dim3:dim3, dim4:dim4, revenue:result.getCell(j, i).value});

                                                  }

                                        }

                                        return newChartData;

                              }