Pingpong
Pingpong

Reputation: 8009

Report parameter hide/show query, in MS SSRS Reporting Web Service 2010

I want to query the hide/show status of parameters of a report. But it seems there is no property that tells that.

I used reporting service 2010, not reportviewer control. http://msdn.microsoft.com/en-us/library/reportservice2010.itemparameter.aspx

Below is my code:

public class ReportingService
{
    private ReportingService2010 reportingService = null;

    public ReportingService()
    {
        reportingService = new ReportingService2010();
        reportingService.Credentials = CredentialCache.DefaultCredentials;
    }

    internal IList<ReportParameter> GetReportParameter(string reportUrl)
    {
        string historyId = null;
        bool forRendering = false;
        ParameterValue[] values = null;
        DataSourceCredentials[] credentialses = null;
        ItemParameter[] parameters = null;

        try
        {
            parameters = reportingService.GetItemParameters(reportUrl, historyId, forRendering, values, credentialses);

            foreach (var parameter in parameters)
            {
                //parameter.Name;
                //parameter.Prompt;
                //parameter.DefaultValues.FirstOrDefault();

                //Problem:
                //how to get the show/hide status of the parameter.
                //the PromptUser returns true only when both hide and prompt 
                //are false, but when hide is true, it return true.
                //The rdl is edited via IE. It can be also edited via BI, and others.
            }

            return reportParameters;
        }
        catch (SoapException e)
        {
            throw;
            //e.Detail.InnerXml.ToString();
        }
    }        
}

Any idea would be very much appreciated!

Upvotes: 3

Views: 2449

Answers (3)

codeulike
codeulike

Reputation: 23064

From here:

There is no "Hidden" property that you can check directly. Rather, you need to look at both the Prompt and PromptUser properties on the ReportParameter class:

PromptUser == false --> Parameter is "Internal"

PromptUser == true && Prompt is null or empty --> Parameter is "Hidden"

PromptUser == true && Prompt is NOT null or empty --> Parameter is visible

Upvotes: 1

Pingpong
Pingpong

Reputation: 8009

  private bool IsShown(ItemParameter parameter)
        {
            return parameter.PromptUser && !string.IsNullOrEmpty(parameter.Prompt);
        }

Upvotes: 6

PaulStock
PaulStock

Reputation: 11263

Did you check the parameter.Visible property? Will that work?

Upvotes: -1

Related Questions