Hi,
I am trying to pass parameters using Reporting service web service. Here is
the code I used. I feel I am not passing validvalues properly. Can anyone
help me. Thanks in advance.
ReportingService rs = new ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
ReportParameter[] repParameters = rs.GetReportParameters(@."/passdownreport/Report1", null, false, null, null);
if(repParameters != null)
{
// Prepare report parameter.
ParameterValue[] parameters = new
ParameterValue[repParameters.Length];
for(int k=0; k<=repParameters.Length-1;k++)
{
if(repParameters[k].Name == "EmployeeNames")
{
parameters[k] = new ParameterValue();
parameters[k].Name = "EmployeeNames";
parameters[k].Value = "john,mary,scott";
}
repParameters[k].ValidValues.SetValue(parameters[k].value,k);
}
rs.SetReportParameters(@."/passdownreport/Report1",repParameters);
===================Thanks===============Would like to elaborate the error I am getting.
Near line mentioned below, it is giving an error like "Object reference not
set to an instance of an object".
rs.SetReportParameters(@."/passdownreport/Report1",repParameters);
When I debug, Valid values is coming as undefined.
I am new to Reporting services programming, and I tried all possible options
from my side. Please help me if anu one of you know, where I went wrong.
Thanks,
bob
"bob" wrote:
> Hi,
> I am trying to pass parameters using Reporting service web service. Here is
> the code I used. I feel I am not passing validvalues properly. Can anyone
> help me. Thanks in advance.
> ReportingService rs = new ReportingService();
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> ReportParameter[] repParameters => rs.GetReportParameters(@."/passdownreport/Report1", null, false, null, null);
> if(repParameters != null)
> {
> // Prepare report parameter.
> ParameterValue[] parameters = new
> ParameterValue[repParameters.Length];
> for(int k=0; k<=repParameters.Length-1;k++)
> {
> if(repParameters[k].Name == "EmployeeNames")
> {
> parameters[k] = new ParameterValue();
> parameters[k].Name = "EmployeeNames";
> parameters[k].Value = "john,mary,scott";
> }
> repParameters[k].ValidValues.SetValue(parameters[k].value,k);
> }
> rs.SetReportParameters(@."/passdownreport/Report1",repParameters);
> ===================Thanks===============>|||Bob,
I have run into something similiar to this using DefaultValues. If
the original report creation did not have a specified DefaultValue for
a report parameter I can not access it or set a value to it. If a
DefaultValue was established at report creation then I could do what I
wanted.
So I'm guessing you aren't getting access to ValidValues because you
didn't specify any on the original report creation. It's worth a look,
I could be way off on your problem, it just appears the same as my
problem when the value comes up as <undefined>. I know of no solution
and am trying to get a response from a MS guy. Hope this helps
understand your problem a bit more.
Frank
bob <bob@.discussions.microsoft.com> wrote in message news:<9F17B95C-B484-46D9-A7F0-FD7BE91DE8EB@.microsoft.com>...
> Would like to elaborate the error I am getting.
> Near line mentioned below, it is giving an error like "Object reference not
> set to an instance of an object".
> rs.SetReportParameters(@."/passdownreport/Report1",repParameters);
> When I debug, Valid values is coming as undefined.
> I am new to Reporting services programming, and I tried all possible options
> from my side. Please help me if anu one of you know, where I went wrong.
> Thanks,
> bob
> "bob" wrote:
> > Hi,
> > I am trying to pass parameters using Reporting service web service. Here is
> > the code I used. I feel I am not passing validvalues properly. Can anyone
> > help me. Thanks in advance.
> >
> > ReportingService rs = new ReportingService();
> > rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> > ReportParameter[] repParameters => > rs.GetReportParameters(@."/passdownreport/Report1", null, false, null, null);
> > if(repParameters != null)
> >
> > {
> > // Prepare report parameter.
> > ParameterValue[] parameters = new
> > ParameterValue[repParameters.Length];
> >
> > for(int k=0; k<=repParameters.Length-1;k++)
> > {
> > if(repParameters[k].Name == "EmployeeNames")
> > {
> > parameters[k] = new ParameterValue();
> > parameters[k].Name = "EmployeeNames";
> > parameters[k].Value = "john,mary,scott";
> >
> > }
> >
> > repParameters[k].ValidValues.SetValue(parameters[k].value,k);
> > }
> >
> > rs.SetReportParameters(@."/passdownreport/Report1",repParameters);
> > ===================Thanks===============> >
> >|||Hi Frank,
Thanks for your help.
I have created a new report with default parameter/value in it. And I used
this report with following code. Still I am facing the same problem.
Is there any ValidValues option in report creation?
bob.
"Stoma_Kalos" wrote:
> Bob,
> I have run into something similiar to this using DefaultValues. If
> the original report creation did not have a specified DefaultValue for
> a report parameter I can not access it or set a value to it. If a
> DefaultValue was established at report creation then I could do what I
> wanted.
> So I'm guessing you aren't getting access to ValidValues because you
> didn't specify any on the original report creation. It's worth a look,
> I could be way off on your problem, it just appears the same as my
> problem when the value comes up as <undefined>. I know of no solution
> and am trying to get a response from a MS guy. Hope this helps
> understand your problem a bit more.
> Frank
> bob <bob@.discussions.microsoft.com> wrote in message news:<9F17B95C-B484-46D9-A7F0-FD7BE91DE8EB@.microsoft.com>...
> > Would like to elaborate the error I am getting.
> >
> > Near line mentioned below, it is giving an error like "Object reference not
> > set to an instance of an object".
> > rs.SetReportParameters(@."/passdownreport/Report1",repParameters);
> >
> > When I debug, Valid values is coming as undefined.
> >
> > I am new to Reporting services programming, and I tried all possible options
> > from my side. Please help me if anu one of you know, where I went wrong.
> >
> > Thanks,
> > bob
> >
> > "bob" wrote:
> >
> > > Hi,
> > > I am trying to pass parameters using Reporting service web service. Here is
> > > the code I used. I feel I am not passing validvalues properly. Can anyone
> > > help me. Thanks in advance.
> > >
> > > ReportingService rs = new ReportingService();
> > > rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> > > ReportParameter[] repParameters => > > rs.GetReportParameters(@."/passdownreport/Report1", null, false, null, null);
> > > if(repParameters != null)
> > >
> > > {
> > > // Prepare report parameter.
> > > ParameterValue[] parameters = new
> > > ParameterValue[repParameters.Length];
> > >
> > > for(int k=0; k<=repParameters.Length-1;k++)
> > > {
> > > if(repParameters[k].Name == "EmployeeNames")
> > > {
> > > parameters[k] = new ParameterValue();
> > > parameters[k].Name = "EmployeeNames";
> > > parameters[k].Value = "john,mary,scott";
> > >
> > > }
> > >
> > > repParameters[k].ValidValues.SetValue(parameters[k].value,k);
> > > }
> > >
> > > rs.SetReportParameters(@."/passdownreport/Report1",repParameters);
> > > ===================Thanks===============> > >
> > >
>|||I was referring to DefaultValues in my case, because I was trying to
retrieve the DefaultValues not ValidValues. In your case, I would
assume you need to add Available Values in the Report Parameter you
are trying to retrieve ValidValues from. Again, I am just taking a
stab here, and I am not perfectly sure, but it's worth a try. I don't
see any MVPs knocking either of us over with answers to our questions.
Good Luck.
Frank
bob <bob@.discussions.microsoft.com> wrote in message news:<6B2337EB-9268-4C3B-B69E-45ABDF5EA094@.microsoft.com>...
> Hi Frank,
> Thanks for your help.
> I have created a new report with default parameter/value in it. And I used
> this report with following code. Still I am facing the same problem.
> Is there any ValidValues option in report creation?
> bob.|||Ok, I believe I've got the answer to both our problems...this may need
personal tweeking...the main line is the if statement...check it out:
foreach (ReportParameter paramRpt in aryReportParameters)
{
if (paramRpt.ValidValues == null)
paramRpt.ValidValues = new string[1];
paramRpt.ValidValues.SetValue(value, 0);
}
bob <bob@.discussions.microsoft.com> wrote in message news:<6B2337EB-9268-4C3B-B69E-45ABDF5EA094@.microsoft.com>...
> Hi Frank,
> Thanks for your help.
> I have created a new report with default parameter/value in it. And I used
> this report with following code. Still I am facing the same problem.
> Is there any ValidValues option in report creation?
> bob.
>|||Hi Kalos,
Thank you very much for your help.
It wokrd for me but I had to make little modification, as mentioned below.
Because ValidValues does not accept String[], so I coded like this and it is
working.
ValidValue v = new ValidValue();
v.Label = "LastName";
v.Value = "Abbas";
foreach (ReportParameter paramRpt in repParameters)
{
if (paramRpt.ValidValues == null)
paramRpt.ValidValues = new ValidValue[1];
paramRpt.ValidValues[0] = v;
}
Regards,
bob
"Stoma_Kalos" wrote:
> Ok, I believe I've got the answer to both our problems...this may need
> personal tweeking...the main line is the if statement...check it out:
> foreach (ReportParameter paramRpt in aryReportParameters)
> {
> if (paramRpt.ValidValues == null)
> paramRpt.ValidValues = new string[1];
> paramRpt.ValidValues.SetValue(value, 0);
> }
>
> bob <bob@.discussions.microsoft.com> wrote in message news:<6B2337EB-9268-4C3B-B69E-45ABDF5EA094@.microsoft.com>...
> > Hi Frank,
> >
> > Thanks for your help.
> >
> > I have created a new report with default parameter/value in it. And I used
> > this report with following code. Still I am facing the same problem.
> >
> > Is there any ValidValues option in report creation?
> >
> > bob.
> >
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment