We have an application that gets a report's parameters and parameter values.
We're using SQL Server 2005. The problem is that we need a couple of the
report's parameters to be non-prompting AND not read-only.
In our application, we dynamically build the UI based on the parameters and
parameter values retrieved from the report, but we only want to display
parameters that are PromptUser = true and not hidden and not read-only.
Here's the code:
ReportingService.ReportingService2005 rs = new
ReportingService.ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
string historyID = null;
bool forRendering = true;
ReportingService.ParameterValue[] values = null;
ReportingService.DataSourceCredentials[] credentials = null;
ReportingService.ReportParameter[] parameters = null;
parameters = rs.GetReportParameters(sReportAndPath, historyID, forRendering,
values, credentials);
if ((parameters != null) && (parameters.Length > 0))
{
foreach (ReportingService.ReportParameter rp in parameters)
{
if (rp.PromptUser)
{
// Display parameter and parameter default values on screen
// Only display parameters that are NOT internal AND NOT hidden
// PromptUser property takes care of the internal
// hidden parameters appear to have a PromptUser = true
}
}
}
How can we do this?
If we set the parameter to internal, then it doesn't display, but we get an
error later when we try to update the parameter value (because it's
read-only). If we set the parameter to hidden, then it gets displayed on
screen because the PromptUser property is true.
Basically, we want to be able to change the parameter value (thus NOT
read-only), but, at the same time, not display on screen (PromptUser = false).
Hope this makes sense.
Any suggestions?I will be very interested in this answer. I have had it work but only after
messing around with the parameters in report manager. I would be interested
in your type of app that dynamically builds the UI. That is something that
we want to do.
can I contact you by email to discuss ... or can you post here.
"steggun" wrote:
> We have an application that gets a report's parameters and parameter values.
> We're using SQL Server 2005. The problem is that we need a couple of the
> report's parameters to be non-prompting AND not read-only.
> In our application, we dynamically build the UI based on the parameters and
> parameter values retrieved from the report, but we only want to display
> parameters that are PromptUser = true and not hidden and not read-only.
> Here's the code:
>
> ReportingService.ReportingService2005 rs = new
> ReportingService.ReportingService2005();
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> string historyID = null;
> bool forRendering = true;
> ReportingService.ParameterValue[] values = null;
> ReportingService.DataSourceCredentials[] credentials = null;
> ReportingService.ReportParameter[] parameters = null;
> parameters = rs.GetReportParameters(sReportAndPath, historyID, forRendering,
> values, credentials);
> if ((parameters != null) && (parameters.Length > 0))
> {
> foreach (ReportingService.ReportParameter rp in parameters)
> {
> if (rp.PromptUser)
> {
> // Display parameter and parameter default values on screen
> // Only display parameters that are NOT internal AND NOT hidden
> // PromptUser property takes care of the internal
> // hidden parameters appear to have a PromptUser = true
> }
> }
> }
>
> How can we do this?
> If we set the parameter to internal, then it doesn't display, but we get an
> error later when we try to update the parameter value (because it's
> read-only). If we set the parameter to hidden, then it gets displayed on
> screen because the PromptUser property is true.
> Basically, we want to be able to change the parameter value (thus NOT
> read-only), but, at the same time, not display on screen (PromptUser => false).
> Hope this makes sense.
> Any suggestions?
>
>|||"steggun" wrote:
> We have an application that gets a report's parameters and parameter values.
> We're using SQL Server 2005. The problem is that we need a couple of the
> report's parameters to be non-prompting AND not read-only.
> In our application, we dynamically build the UI based on the parameters and
> parameter values retrieved from the report, but we only want to display
> parameters that are PromptUser = true and not hidden and not read-only.
> Here's the code:
>
> ReportingService.ReportingService2005 rs = new
> ReportingService.ReportingService2005();
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> string historyID = null;
> bool forRendering = true;
> ReportingService.ParameterValue[] values = null;
> ReportingService.DataSourceCredentials[] credentials = null;
> ReportingService.ReportParameter[] parameters = null;
> parameters = rs.GetReportParameters(sReportAndPath, historyID, forRendering,
> values, credentials);
> if ((parameters != null) && (parameters.Length > 0))
> {
> foreach (ReportingService.ReportParameter rp in parameters)
> {
> if (rp.PromptUser)
> {
> // Display parameter and parameter default values on screen
> // Only display parameters that are NOT internal AND NOT hidden
> // PromptUser property takes care of the internal
> // hidden parameters appear to have a PromptUser = true
> }
> }
> }
>
> How can we do this?
> If we set the parameter to internal, then it doesn't display, but we get an
> error later when we try to update the parameter value (because it's
> read-only). If we set the parameter to hidden, then it gets displayed on
> screen because the PromptUser property is true.
> Basically, we want to be able to change the parameter value (thus NOT
> read-only), but, at the same time, not display on screen (PromptUser => false).
> Hope this makes sense.
> Any suggestions?
>
>|||What I have found is the a hidden parameter and an actual parameter to
be displayed are only different based on the prompt. An internal's
promptuser will be false and there will be no prompt.
If you remember in RS2000, you had to go into the Report Server
Interface and set the parameters promptuser to true and clear out the
prompt. Although a "hidden" indicator is now available in the IDE for
RS2005, the identification through the web service seems not to have
changed.
So, if you look for rp.promptuser && (rp.Prompt.Length > 0), you will
get the correct parameters to display in the UI. If you want to set
the hidden parameters, obmit the (rp.Prompt.Length > 0).
Hopes this helps.
steggun wrote:
> We have an application that gets a report's parameters and parameter values.
> We're using SQL Server 2005. The problem is that we need a couple of the
> report's parameters to be non-prompting AND not read-only.
> In our application, we dynamically build the UI based on the parameters and
> parameter values retrieved from the report, but we only want to display
> parameters that are PromptUser = true and not hidden and not read-only.
> Here's the code:
>
> ReportingService.ReportingService2005 rs = new
> ReportingService.ReportingService2005();
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> string historyID = null;
> bool forRendering = true;
> ReportingService.ParameterValue[] values = null;
> ReportingService.DataSourceCredentials[] credentials = null;
> ReportingService.ReportParameter[] parameters = null;
> parameters = rs.GetReportParameters(sReportAndPath, historyID, forRendering,
> values, credentials);
> if ((parameters != null) && (parameters.Length > 0))
> {
> foreach (ReportingService.ReportParameter rp in parameters)
> {
> if (rp.PromptUser)
> {
> // Display parameter and parameter default values on screen
> // Only display parameters that are NOT internal AND NOT hidden
> // PromptUser property takes care of the internal
> // hidden parameters appear to have a PromptUser = true
> }
> }
> }
>
> How can we do this?
> If we set the parameter to internal, then it doesn't display, but we get an
> error later when we try to update the parameter value (because it's
> read-only). If we set the parameter to hidden, then it gets displayed on
> screen because the PromptUser property is true.
> Basically, we want to be able to change the parameter value (thus NOT
> read-only), but, at the same time, not display on screen (PromptUser => false).
> Hope this makes sense.
> Any suggestions?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment