locked
How to send filter from one members selection page to another report page in my custom site? RRS feed

  • Question

  • Hello!

    My website run in internet not intranet .  I just use PerformancePoint Monitoring , Dashboard desinger and SSAS in background.

    My website's software environment is like that:  Dot Net FrameWork 2.0 ; SqlServer2005 Sp2 ;AS; ASPX;

    I wrote two pages .The first page accomplishes  filter ,and the second page reports the result.

    Why do this  is to consider that in first page , the items to filter is big, users could customize ,and seach the items they wanted. This way is which user is easy to accept more than a long tree control.

    Now , I finished the second page ,the page consists of two parameter trees ,one AnalysisGrid , one AnalysisChart. The two trees is linked to the grid and chart.
    But I can't acomplish the first page,beacause I do not know how to send the items filtered to the second page for refresh.

    I have a idea that in first page, according to items users filtered , dynamically set the section <MyDataTable><key>....</key></MyDataTable> in column  PPSMonitoring.dbo.ParameterValues.[SerializedXml] , then return to the second page. the second page will display the result users wanted. beacuse the parameter trees'  seleceted items were controlled by the column  PPSMonitoring.dbo.ParameterValues.[SerializedXml] .But i can't how to set the values of the section. i don't find the relation between the key and those display items.

    Please give me some good suggest.

    baronbig@hotmail.com or baronbig@163.com



    Monday, July 6, 2009 3:47 PM

Answers

  • You can set the filters throught PPS API at server side.

    I made an intermediate aspx page to receive filter values and store them, before forwarding to the report page.

    ch_syam: It's MD5 hash!

     

    Example:

    http://server/_layouts/forward.aspx?STED=[Sted].[Sted].*[17]&PAGE=http://server/dashboards/dashboard.aspx

    or

    http://server/_layouts/forward.aspx?/Lists/PPS Elementer/5_.000=[Sted].[Sted].*[17]&PAGE=http://server/dashboards/dashboard.aspx

     

    Comments are in norwegian. Try google translate.

     

    <%@ Page Language="C#"%>
    <%@ Assembly Name="Microsoft.PerformancePoint.Scorecards.ServerCommon, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
    <%@ Assembly Name="Microsoft.PerformancePoint.Scorecards.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
    
    <%@ Import Namespace="Microsoft.PerformancePoint.Scorecards.ServerCommon" %>
    <%@ Import Namespace="Microsoft.PerformancePoint.Scorecards" %>
    <%@ Import Namespace="Microsoft.PerformancePoint.Scorecards.Store" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <script runat="server" language="C#">
      public string CreateMD5Hash(string input)
      {
        // Use input string to calculate MD5 hash
        System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
        byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
        byte[] hashBytes = md5.ComputeHash(inputBytes);
    
        // Convert the byte array to hexadecimal string
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < hashBytes.Length; i++)
        {
          sb.Append(hashBytes[i].ToString("X2"));
          // To force the hex string to lower-case letters instead of
          // upper-case, use he following line instead:
          // sb.Append(hashBytes[i].ToString("x2")); 
        }
        return sb.ToString();
      }
      public void SaveFilterValue(string URI, string Selection)
      {
        RepositoryLocation repositoryDataSourceLocation = RepositoryLocation.CreateFromUriString(URI);
    
        //empty
        ParameterDefinition parameterDef = new ParameterDefinition();
    
        List<string> selectedValues = new List<string>();
        selectedValues.Add(CreateMD5Hash(Selection));
    
        //get context
        BIMonitoringServiceApplicationProxy proxy = BIMonitoringServiceApplicationProxy.Default;
    
        proxy.SaveFilterValues(
          repositoryDataSourceLocation,
          parameterDef,
          selectedValues);  
      }
    </script>
    
    <%
      /*
       * Denne filen brukes for å hente filterparametre fra url og videreformidle til filterene på siden.
       * Eksterne applikasjoner kan bruke denne siden for å sende filterverdier inn til PPS.
       * Siden kjører Response.Redirect for å sende videre til mål-side.
       * (Bruker Performancepoint sitt API for å lagre.)
       * 
       * Eks: http://cawf209n:92/_layouts/SR/forward.aspx?/Lists/PPS Elementer/5_.000=[Sted].[Sted].*[17]&PAGE=http://cawf209n:92/PPS%20Dashboards/FSU/Regnskap.aspx
       * 
       * Filter har følgende navn i PPS (Sted): "/Lists/PPS Elementer/5_.000"
       * Gis verdien: "[Sted].[Sted].*[17]" (Sum forretningsstøtte)
       * Videresender til: http://cawf209n:92/PPS%20Dashboards/FSU/Regnskap.aspx (som har filterene i bruk på siden)
       */
    
      //Sharepoint bruker location som id for objektene - må konvertere fra displayname DERSOM lookup navn øsnkes å brukes
      Dictionary<string, string> NameToLocationLookup = new Dictionary<string, string>();
      NameToLocationLookup.Add("TID", "/Lists/PPS Elementer/1_.000");
      NameToLocationLookup.Add("STED", "/Lists/PPS Elementer/5_.000");
    
      string forwardTo = string.Empty;
      
      foreach (string param in Request.QueryString.Keys)
      {
        Response.Write(param + " - " + Request.QueryString[param]);
        
        //Verdi tilhørende parameter
        string paramValue = Request.QueryString[param].Replace("*", "&");
        
        if (param.ToUpper().Equals("PAGE"))
        {
          forwardTo = paramValue;
          continue;
        }
    
        if (param.Substring(0, 1).Equals("/"))
        {
          //Trenger ikke lookup da filter er angitt med relativ sti
          SaveFilterValue(param, paramValue);
        }
        //Sjekk om url parameter fins i NameToLocationLookup - i så fall lagre verdi for bruker
        else if (NameToLocationLookup.ContainsKey(param.ToUpper()))
        {
          //& i UniqueName må byttes ut med * fra siden som videresender til denne siden da & angir ny url parameter
          SaveFilterValue(NameToLocationLookup[param.ToUpper()], Request.QueryString[param].Replace("*", "&"));
        }     
      }
    
      if (!string.IsNullOrEmpty(forwardTo))
        Response.Redirect(forwardTo);
      else
        Response.Write("'PAGE' parameter missing.");
    
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
      <title></title>
    </head>
    <body>
      <form id="form1" runat="server">
      <div>
      
      </div>
      </form>
    </body>
    </html>
    
    

    Tuesday, May 10, 2011 12:14 PM

All replies

  • I believe you are look for this type of functionality - PerformancePoint Text Filter – URL Parameterization
    Dan English's BI Blog
    _____________________________________________________
    Please mark posts as answer or helpful when they are.
    Saturday, August 1, 2009 1:13 PM
  • I am in the same boat as Baron. Does anyone know what kind of encoding/encryption is used for filter values. I see hexadecimal characters in <Key> node in  <MyDataTable><key>....</key></MyDataTable>
    Friday, May 6, 2011 2:03 PM
  • You can set the filters throught PPS API at server side.

    I made an intermediate aspx page to receive filter values and store them, before forwarding to the report page.

    ch_syam: It's MD5 hash!

     

    Example:

    http://server/_layouts/forward.aspx?STED=[Sted].[Sted].*[17]&PAGE=http://server/dashboards/dashboard.aspx

    or

    http://server/_layouts/forward.aspx?/Lists/PPS Elementer/5_.000=[Sted].[Sted].*[17]&PAGE=http://server/dashboards/dashboard.aspx

     

    Comments are in norwegian. Try google translate.

     

    <%@ Page Language="C#"%>
    <%@ Assembly Name="Microsoft.PerformancePoint.Scorecards.ServerCommon, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
    <%@ Assembly Name="Microsoft.PerformancePoint.Scorecards.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
    
    <%@ Import Namespace="Microsoft.PerformancePoint.Scorecards.ServerCommon" %>
    <%@ Import Namespace="Microsoft.PerformancePoint.Scorecards" %>
    <%@ Import Namespace="Microsoft.PerformancePoint.Scorecards.Store" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <script runat="server" language="C#">
      public string CreateMD5Hash(string input)
      {
        // Use input string to calculate MD5 hash
        System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
        byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
        byte[] hashBytes = md5.ComputeHash(inputBytes);
    
        // Convert the byte array to hexadecimal string
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < hashBytes.Length; i++)
        {
          sb.Append(hashBytes[i].ToString("X2"));
          // To force the hex string to lower-case letters instead of
          // upper-case, use he following line instead:
          // sb.Append(hashBytes[i].ToString("x2")); 
        }
        return sb.ToString();
      }
      public void SaveFilterValue(string URI, string Selection)
      {
        RepositoryLocation repositoryDataSourceLocation = RepositoryLocation.CreateFromUriString(URI);
    
        //empty
        ParameterDefinition parameterDef = new ParameterDefinition();
    
        List<string> selectedValues = new List<string>();
        selectedValues.Add(CreateMD5Hash(Selection));
    
        //get context
        BIMonitoringServiceApplicationProxy proxy = BIMonitoringServiceApplicationProxy.Default;
    
        proxy.SaveFilterValues(
          repositoryDataSourceLocation,
          parameterDef,
          selectedValues);  
      }
    </script>
    
    <%
      /*
       * Denne filen brukes for å hente filterparametre fra url og videreformidle til filterene på siden.
       * Eksterne applikasjoner kan bruke denne siden for å sende filterverdier inn til PPS.
       * Siden kjører Response.Redirect for å sende videre til mål-side.
       * (Bruker Performancepoint sitt API for å lagre.)
       * 
       * Eks: http://cawf209n:92/_layouts/SR/forward.aspx?/Lists/PPS Elementer/5_.000=[Sted].[Sted].*[17]&PAGE=http://cawf209n:92/PPS%20Dashboards/FSU/Regnskap.aspx
       * 
       * Filter har følgende navn i PPS (Sted): "/Lists/PPS Elementer/5_.000"
       * Gis verdien: "[Sted].[Sted].*[17]" (Sum forretningsstøtte)
       * Videresender til: http://cawf209n:92/PPS%20Dashboards/FSU/Regnskap.aspx (som har filterene i bruk på siden)
       */
    
      //Sharepoint bruker location som id for objektene - må konvertere fra displayname DERSOM lookup navn øsnkes å brukes
      Dictionary<string, string> NameToLocationLookup = new Dictionary<string, string>();
      NameToLocationLookup.Add("TID", "/Lists/PPS Elementer/1_.000");
      NameToLocationLookup.Add("STED", "/Lists/PPS Elementer/5_.000");
    
      string forwardTo = string.Empty;
      
      foreach (string param in Request.QueryString.Keys)
      {
        Response.Write(param + " - " + Request.QueryString[param]);
        
        //Verdi tilhørende parameter
        string paramValue = Request.QueryString[param].Replace("*", "&");
        
        if (param.ToUpper().Equals("PAGE"))
        {
          forwardTo = paramValue;
          continue;
        }
    
        if (param.Substring(0, 1).Equals("/"))
        {
          //Trenger ikke lookup da filter er angitt med relativ sti
          SaveFilterValue(param, paramValue);
        }
        //Sjekk om url parameter fins i NameToLocationLookup - i så fall lagre verdi for bruker
        else if (NameToLocationLookup.ContainsKey(param.ToUpper()))
        {
          //& i UniqueName må byttes ut med * fra siden som videresender til denne siden da & angir ny url parameter
          SaveFilterValue(NameToLocationLookup[param.ToUpper()], Request.QueryString[param].Replace("*", "&"));
        }     
      }
    
      if (!string.IsNullOrEmpty(forwardTo))
        Response.Redirect(forwardTo);
      else
        Response.Write("'PAGE' parameter missing.");
    
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
      <title></title>
    </head>
    <body>
      <form id="form1" runat="server">
      <div>
      
      </div>
      </form>
    </body>
    </html>
    
    

    Tuesday, May 10, 2011 12:14 PM
  • Thanks Heidi. I got another question. In [PPSParameterValues] table, we have [Login] column. But I don't see a place holder/parameter for proxy.SaveFilterValues() to pass it in.

    Wednesday, May 18, 2011 4:42 PM