Solved

Passing parameters from ASP page to report viewer SSRS report

Posted on 2009-04-01
6
1,119 Views
Last Modified: 2016-02-13
1) What do I have to do to the SSRS report? (create parameters?)
2) What do I have to do on the ASP page to pass it through?
Do you have a code snippet?

I found some answers in the knowledge base, but had broken links.
Using SSRS 2005, VS 2008.
0
Comment
Question by:guspan
  • 3
  • 2
6 Comments
 
LVL 26

Accepted Solution

by:
Chris Luttrell earned 500 total points
ID: 24044105
This is the code where we load the parameters and is called by this line
rptViewer.ServerReport.SetParameters(loadKPIParameters(report))
    #region KPI Recognition Methods
    private ReportParameter[] loadKPIParameters(string reportPath)
    {
        //declaring and initializing local variables
        MyAppAccordionFilter filter = (MyAppAccordionFilter)Session["MyAppAccordionFilter"];
        ReportParameter[] rptParams = null;
        ReportServerQuery.ReportService.ReportParameter[] thisRptParams = null;
        string[] rptAuth = MyAppApplication.getMyAuthenticatedUserGroup();
        ArrayList lparamList = new ArrayList();
        thisRptParams = ReportServerQuery.ReportServerQuery.GetParametersForReport(rptAuth, reportPath);
 
        //looping through the parameters and filling in those it recognizes
        for (int i = 0; i < thisRptParams.Length; i++)
        {
            if (thisRptParams[i].PromptUser)
            {
                switch (thisRptParams[i].Name)
                {
                    case "FilterLevel": //Scorecard Parameter
                        lparamList.Add(new ReportParameter(thisRptParams[i].Name, getFilterLevel(filter)));
                        break;
                    case "FilterId": //Scorecard Parameter
                        lparamList.Add(new ReportParameter(thisRptParams[i].Name, getFilterId(filter)));
                        break;
                    case "FiscalYear":
                        lparamList.Add(new ReportParameter(thisRptParams[i].Name, getFiscalYear(filter)));
                        break;
                    case "FiscalPeriod":
                        lparamList.Add(new ReportParameter(thisRptParams[i].Name, getFiscalPeriod(filter)));
                        break;
                    case "ReportLevel":
                        lparamList.Add(new ReportParameter(thisRptParams[i].Name, getReportLevel(filter)));
                        break;
                    case "NAFD_ID":
                        lparamList.Add(new ReportParameter(thisRptParams[i].Name, getNAFD_ID(filter)));
                        break;
                }
            }
        }
 
        //creating a list of parameters to hand to the viewer
        rptParams = new ReportParameter[lparamList.Count];
        for (int i = 0; i < lparamList.Count; i++)
            rptParams[i] = (ReportParameter)lparamList[i];
 
        //returning the parameters
        return rptParams;
    }

Open in new window

0
 

Author Comment

by:guspan
ID: 24072854
From a C# Webpage?
0
 
LVL 26

Expert Comment

by:Chris Luttrell
ID: 24074349
Yes, this is from the code behind in an aspx.cs page.
0
 

Author Comment

by:guspan
ID: 24088423
Not too familiar with c#, but loadKPIparameters is a arbitrary method I name?
This isn't specific to KPI in SSAS is it?
0
 
LVL 26

Expert Comment

by:Chris Luttrell
ID: 24088654
No, not part of SSAS that is just our method name in the code I copied.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SSRS Report Help - Excel format 5 83
SSRS expression Issue finding a string 10 79
SSRS - Generating separate reports for each department 2 68
SSRS  - Dropdown with Null 3 25
Written by Valentino Vranken. A while ago I wrote an article called Chart Optimization Tips (http://www.experts-exchange.com/articles/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Chart-Optimization-Tips.html).  This article explained how …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question