Showing posts with label parameters. Show all posts
Showing posts with label parameters. Show all posts

Tuesday, March 27, 2012

Error programaticaly rendering a report using Reporting Services Web Services

I'm using Reporting Services 2005 SP1 and wrote some code to render reports server-side.
My sample report has few parameters that must be passed so I pass these parameters with code.

<My code>
ReportServiceExecution.ReportExecutionService rs = new ReportServiceExecution.ReportExecutionService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
string extension, mimeType, encoding;
ReportServiceExecution.Warning[] warnings;
string[] streamID;

ParameterValue[] parameters = new ParameterValue[2];

parameters[0] = new ParameterValue();
parameters[0].Name = "pID";
parameters[0].Value = "6548747";

parameters[1] = new ParameterValue();

parameters[1].Name = "pClass";

parameters[1].Value = "8";

ExecutionHeader header = new ExecutionHeader();
ExecutionInfo executionInfo = rs.LoadReport(reportPayslip.Name, null);
executionInfo = rs.SetExecutionParameters(parameters, "en-us");
rs.ExecutionHeaderValue = header;
rs.ExecutionHeaderValue.ExecutionID = executionInfo.ExecutionID;

byte[] report = rs.Render("PDF", "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>", out extension, out mimeType, out encoding, out warnings, out streamID);
</My code>

Actually, I have several more parameters but I've checked the collection and all the parameters I want are there and have values. Their names match those found in executionInfo.Parameters. But when I run my code I get the following error on Render():

<Error>
"This report requires a default or user-defined value for the report parameter 'pClass'. To run or subscribe to this report, you must provide a parameter value. > This report requires a default or user-defined value for the report parameter 'pClass'. To run or subscribe to this report, you must provide a parameter value. > This report requires a default or user-defined value for the report parameter 'pClass'. To run or subscribe to this report, you must provide a parameter value."
</Error>

I've double-checked and my parameter array does have the problematic parameter, I passed it a value but when I check executionInfo.Parameters I see that it's the only parameter that hasn't been give a default value after calling SetExecutionParameters(). So my parameters do seem to be passed but one seems to refuse getting a value. If I comment out the SetExecutionParameters() line I get, as expected a similar error but on another parameter (first one in the executionInfo.Parameters collection). So I'm left to beleive that the SetExecutionParameters() has some kind of bug as it works for all but one parameter. I've checked casing, spelling, tried passing phony parameters and from what I've seen I should be getting an error when I pass the parameters if I got something wrong.

Any help would be much appreciated.

I've done some (desperate) tests and changed the following line:
executionInfo = rs.SetExecutionParameters(parameters, "en-us");
to
executionInfo = rs.SetExecutionParameters(parameters, "fr-ch");
I'm currently based in French Switzerland but our reports are written in english, besides, the documentation about this parameter is basically "A .Net language" which is not very helpful. So now it works but I'm afraid if I have to access a server that is of another culture it will fail.

Friday, March 9, 2012

error msg when using parameters

Anyone know how to fix this error?
Error 1 [rsInvalidReportParameterDependency]
The report parameter 'district' has a DefaultValue or a ValidValue
that depends on the report parameter "district". Forward
dependencies are not valid.
Thanks!try adding a new dataset, just to be used for the parameter values and then
put them as your default or available values, what ever you are using them
for.
"aggiechick717" <mhoppe@.chkenergy.com> wrote in message
news:1156436830.792903.191820@.b28g2000cwb.googlegroups.com...
> Anyone know how to fix this error?
> Error 1 [rsInvalidReportParameterDependency]
> The report parameter 'district' has a DefaultValue or a ValidValue
> that depends on the report parameter "district". Forward
> dependencies are not valid.
> Thanks!
>|||Normally forward dependencies occur when you are trying to populate the
default value, or valid values of one parameter based on another parameter
that hasn't been set yet.
E.g. If you wanted users to select a region first, and then have a dropdown
which only allowed them to select districts in that region, you would need to
ensure that that region parameter appeared above the district parameter in
the list on the report parameters page (from the layout tab of visual studio).
In your case however, a parameter called district seems to have a forward
dependency on another parameter also called distict... have you got two
parameters with the same name?
"aggiechick717" wrote:
> Anyone know how to fix this error?
> Error 1 [rsInvalidReportParameterDependency]
> The report parameter 'district' has a DefaultValue or a ValidValue
> that depends on the report parameter "district". Forward
> dependencies are not valid.
> Thanks!
>

Sunday, February 26, 2012

Error message with stored procedure

This error message appears when you try to call a stored procedure and
supply more parameters than those declared for that procedure. Look at the
code where you call the UpdateResources procedure and check that you pass
the correct parameter list.

HTH,

Plamen Ratchev
http://www.SQLStudio.comI see only the definition for the update parameters, not the actual data
binding. Look at the asp:BoundField tags and make sure the DataField values
are correct and there is no duplication of names. Data bound fields
automatically are added to a collection that gets submitted as parameters.
See more details here:
http://msdn2.microsoft.com/en-us/library/ms228051.aspx
Also, make sure that ConflictDetection (a property of the data source) is
not set to CompareAllValues (it is set to OverwriteChanges by default). If
you have it set to CompareAllValues then two sets of parameters are passed,
one for the updated and one for the original values.

HTH,

Plamen Ratchev
http://www.SQLStudio.com|||Forgot to say - a good way to troubleshoot something like this is to use SQL
Profiler to see what SQL statements actually get submitted.

Plamen Ratchev
http://www.SQLStudio.com|||On Oct 29, 4:19 pm, "Plamen Ratchev" <Pla...@.SQLStudio.comwrote:

Quote:

Originally Posted by

Forgot to say - a good way to troubleshoot something like this is to use SQL
Profiler to see what SQL statements actually get submitted.
>
Plamen Ratchevhttp://www.SQLStudio.com


okay Thanks will try that.

Sunday, February 19, 2012

error message for blank reports

When requesting reports, if a user supplies values in the parameters
for which there is no data on the database, how can I stop him/her on
this screen with an error popup display box or a message on the report
like 'no records available for the specified criteria' instead of
generating a blank report with only headers and footers.I am not sure about the other data regions such as list or matrix, but I know
that if you are using a table you can go into the table properties and put
the message that you would like to display under the "No Rows" property.
"bevarg" wrote:
> When requesting reports, if a user supplies values in the parameters
> for which there is no data on the database, how can I stop him/her on
> this screen with an error popup display box or a message on the report
> like 'no records available for the specified criteria' instead of
> generating a blank report with only headers and footers.
>|||Check the NoRows property of the table. You can enter a message there.