views:

701

answers:

4

I working with Reporting services in Sharepoint Mode, I am able to show the report in Sql Server Reporting services report viwer , the report has multiple parameters , My question is how do I pass more thatn one parameter from a custome web part to this report.

I am able to pass one parameter by implementing the ITransformableFilterValues interface in the custom webpart , what I want to do is pass more than one parameter .

Ex: If there are 2 parameters on report then i should able to map each from the control in webpart.

Any help or guidance is appreciated.

A: 

I'm not sure about SharePoint integrated mode, but ReportServer correctly accept parameters passed via URL string.

A: 

Can you provide the example you have working, even if it's just the one parameter? It would be a big help.

Thanks, Megan

Megan
A: 

Here is the Code for Custom Webpart

using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using aspnetwebparts = System.Web.UI.WebControls.WebParts; //using Microsoft.Office.Server.Utilities; using wsswebparts = Microsoft.SharePoint.WebPartPages; //using Microsoft.SharePoint.Portal.WebControls; using System.Collections.ObjectModel; using Microsoft.SharePoint.Utilities; using System.Data; using System.Collections;

namespace CustomWebPart { /// /// Used to provide filter values for the status report. /// public class StatusReportFiler : aspnetwebparts.WebPart, wsswebparts.ITransformableFilterValues { DropDownList ddlCategory; ListItem lstItem; Label lblCaption;

    public virtual bool AllowMultipleValues
    {
        get
        {
            return false;
        }
    }
    public virtual bool AllowAllValue
    {
        get
        {
            return true;
        }
    }

    public virtual bool AllowEmptyValue
    {
        get
        {
            return false;
        }
    }
    public virtual string ParameterName
    {
        get
        {
            return "Category";
        }
    }



    public virtual ReadOnlyCollection<string> ParameterValues
    {
        get
        {
            string[] values = this.GetCurrentlySelectedCategory();
            return values == null ?
                null :
                new ReadOnlyCollection<string>(values);
        }
    }


    protected override void CreateChildControls()
    {


        lblCaption = new Label();
        lblCaption.Text = "&nbsp; Category:&nbsp;";

        Controls.Add(lblCaption);

        ddlCategory = new DropDownList();
        ddlCategory.AutoPostBack = true;

        lstItem = new ListItem();
        lstItem.Text = "Select All Category";
        lstItem.Value = "0";
        ddlCategory.Items.Add(lstItem);
        lstItem = null;


        lstItem = new ListItem();
        lstItem.Text = "BING";
        lstItem.Value = "Bing";
        ddlCategory.Items.Add(lstItem);
        lstItem = null;

        lstItem = new ListItem();
        lstItem.Text = "Google";
        lstItem.Value = "Google";
        ddlCategory.Items.Add(lstItem);
        lstItem = null;


        Controls.Add(ddlCategory);



       // base.CreateChildControls();
    }


    [aspnetwebparts.ConnectionProvider("Category Filter", "ITransformableFilterValues", AllowsMultipleConnections = true)]
    public wsswebparts.ITransformableFilterValues SetConnectionInterface()
    {
        return this;
    }
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
    }

    public string[] GetCurrentlySelectedCategory()
    {
        string[] selCategory = new string[1];
        selCategory[0] = ddlCategory.SelectedValue;
        return selCategory;
    }

    protected override void RenderContents(HtmlTextWriter htmlWriter)
    {


        /*htmlWriter.Write("<table border=\"0\" width=\"100%\">");
        htmlWriter.Write("<tr><td>");
        lblCaption.RenderControl(htmlWriter);
        htmlWriter.Write("</td></tr>");
        htmlWriter.Write("<tr><td>");
        lblCaption.RenderControl(htmlWriter);
        htmlWriter.Write("</td></tr>");
        htmlWriter.Write("</table>");*/

        this.EnsureChildControls();
        RenderChildren(htmlWriter);

    }

}

}

1.Once you build this Webpart deploy it to SharePoint. Create a Webpart page in Sharpoint , Add the Custom Web Part to the page . Once you add it you will be able to see the dropdownlist with values on the Webpart .

2.In another Add Webpart Section add a Sql Server Reporting Sevices ReportViewer web part and set the report URL in the properties section and click apply , this report should have the same parameter name as in Custom Webpart.

  1. In the Custom Webpart click on Edit -> Connections-> Send Category Filter To -> ReportViewer - AAAA(This is the ReportName I Guess). This will popup a Window with the mapping section , Map the Filer Category to Filtered parameter on the Report and click Finish . This will pass the value from the Webpart to the Report.

Hope this helps.

citigov
A: 

Is this problem sorted out

prashob