Martyn

Martyn Bullerwell's Blog

The PerformancePoint WebServices - Retrieving Data

In a previous post, I have discussed retrieving information from the PPS WebServices, namely, retrieving the system information, that returns information on the Applications stored within PPS.  To retrieve any further data from PPS WebServices, we need to know the application ID, which is returned from the GetSystem() method.

Once you have retrieved the applications, you may notice that there are not a huge amount of WebServices methods available for use.  This is because one WebServices is used to retrieve most data from PPS.  Again we are going to use the MetaDataManager.asmx, WebServices, and the method we can use is the Request method, that expects an object called a PerformancePointRequest, and in turn returns a PerformancePointResponse.  A PerformancePointRequest can be made to retrieve all sorts of information from PPS, and this is always returned to a PerformancePointResponse.  Here is an example of code that returns Cycle instance information.

MetaDataManager.QueryFilter ppQueryFilter = new MetaDataManager.QueryFilter();
ppQueryFilter.ResultDataType = MetaDataManager.ReferenceDataType.CycleInstances;

MetaDataManager.QueryWorkflowData performancePointRequest = new MetaDataManager.QueryWorkflowData();
performancePointRequest.TargetObjectId = ApplicationID;
performancePointRequest.QueryFilter = ppQueryFilter;
MetaDataManager.PerformancePointResponse ppsResp = ppsMDM.Request(performancePointRequest);
return ppsResp;

So the PerformancePointResponse will return a standard object that can be successfully cast to a number of different objects, I have not used all objects as yet, however we have most experience with the 'WorkflowDataResponse' object.  So casting the PerformancePointResponse object, to a 'WorkflowDataResponse'  object, we know have a Workflow Data Object that is a set of data tables that re compressed.  So.. To get the data we need to de-compress this.  The following shows how I have gone about decompressing this:

First we need to get the Table Schema, that is compressed:

public static DataTable UnpackTableSchema(byte[] packedTableSchema)
{
  DataTable table2 = new DataTable();
  XmlSerializer dataTableSerializer = new XmlSerializer(typeof(DataTable));
  if (packedTableSchema == null)
    {
      return null;
    }
      DataTable table = null;
      using (MemoryStream stream = new MemoryStream(packedTableSchema))
      {
        using (GZipStream stream2 = new GZipStream(stream, CompressionMode.Decompress, true))
        {
          table = dataTableSerializer.Deserialize(stream2) as DataTable;
        }
      }
      table2 = table;
    }
return table2;
}

Once we have the unpacked schema, we can unpack the data and load it against the schema:

There are quite a few methods to actually unpacking the data, so if you are interested please do not hesitate to contact me.  Also, once we have finished the product, it will be available for download at http://www.adatis.co.uk.  Should you like to take a look at our BETA please email us at devteam@adatis.co.uk

Loading