开发者

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 Reportin开发者_StackOverflow中文版gService2010();
        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!


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


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜