Monday, March 26, 2012

parameter collection

greetings -
I am trying to set up a custom parameters page in an ASP .NET application -
I am in the process of choosing between keeping the values (information I
need to list the parameters for the reports, as well as the available, valid
and default values for any given report) in a database or access all I need
through reporting services (web service).
Does anyone have any advice for setting up a Web App to run rs reports - can
you get all you need from the rs web services to create a custom parameter
page, or is it better to retrieve the values you need from a database?
I can dynamically build the custom parm page using values from a database
(dynamically list the parms for the report, fire off the sp to return valid
values for the parm and set the default value) - I would like to get this
going using the web services but am stuck at the point of trying to fill the
valid parm values - I do have the name of the stored procedure to run to
retrieve the valid values for the parm, but can't seem to figure out how to
either a)get the name of the sp to run, or b)just do a databind some how to
my dynamic control (what ever that may be - a textbox, a list box, a drop
down list, etc.)
Any ideas - ?
ThanksI have done exactly this, but the code is at work and it is a (very) long
weekend.
You can certainly use the web services to retrieve everything - the trick to
getting the values you have set up from datasets that populate the possible
values etc is to that when you run the GetReportParameters method, make sure
you set the ForRendering option to true - then everything you need comes
back.
Have a go and I'll post my code on Tuesday
--
Mary Bray [SQL Server MVP]
Please reply only to newsgroups
"Myles" <Myles@.discussions.microsoft.com> wrote in message
news:44942D91-7D8D-4514-91BE-E0FD9E9750FA@.microsoft.com...
> greetings -
> I am trying to set up a custom parameters page in an ASP .NET
> application -
> I am in the process of choosing between keeping the values (information I
> need to list the parameters for the reports, as well as the available,
> valid
> and default values for any given report) in a database or access all I
> need
> through reporting services (web service).
> Does anyone have any advice for setting up a Web App to run rs reports -
> can
> you get all you need from the rs web services to create a custom parameter
> page, or is it better to retrieve the values you need from a database?
> I can dynamically build the custom parm page using values from a database
> (dynamically list the parms for the report, fire off the sp to return
> valid
> values for the parm and set the default value) - I would like to get this
> going using the web services but am stuck at the point of trying to fill
> the
> valid parm values - I do have the name of the stored procedure to run to
> retrieve the valid values for the parm, but can't seem to figure out how
> to
> either a)get the name of the sp to run, or b)just do a databind some how
> to
> my dynamic control (what ever that may be - a textbox, a list box, a drop
> down list, etc.)
> Any ideas - ?
>
> Thanks
>
>|||Thank you for the reply Mary - I may need a little help yet,
I went back and read my question and I was so involved I think I mis-stated
my question! Do the web services expose the names of the stored procedures
used to fill the valid values for the parameters - from your response it
sounds as if you just use the GetReportParameters method and that returns
everything (all of the datasets for all of the parameters) - if that's the
case how do you separate or sort through it all...HELP!
It was a very long weekend - and I still didn't get anything done!
Thanks,
"Mary Bray [MVP]" wrote:
> I have done exactly this, but the code is at work and it is a (very) long
> weekend.
> You can certainly use the web services to retrieve everything - the trick to
> getting the values you have set up from datasets that populate the possible
> values etc is to that when you run the GetReportParameters method, make sure
> you set the ForRendering option to true - then everything you need comes
> back.
> Have a go and I'll post my code on Tuesday
> --
> Mary Bray [SQL Server MVP]
> Please reply only to newsgroups
> "Myles" <Myles@.discussions.microsoft.com> wrote in message
> news:44942D91-7D8D-4514-91BE-E0FD9E9750FA@.microsoft.com...
> > greetings -
> >
> > I am trying to set up a custom parameters page in an ASP .NET
> > application -
> > I am in the process of choosing between keeping the values (information I
> > need to list the parameters for the reports, as well as the available,
> > valid
> > and default values for any given report) in a database or access all I
> > need
> > through reporting services (web service).
> >
> > Does anyone have any advice for setting up a Web App to run rs reports -
> > can
> > you get all you need from the rs web services to create a custom parameter
> > page, or is it better to retrieve the values you need from a database?
> >
> > I can dynamically build the custom parm page using values from a database
> > (dynamically list the parms for the report, fire off the sp to return
> > valid
> > values for the parm and set the default value) - I would like to get this
> > going using the web services but am stuck at the point of trying to fill
> > the
> > valid parm values - I do have the name of the stored procedure to run to
> > retrieve the valid values for the parm, but can't seem to figure out how
> > to
> > either a)get the name of the sp to run, or b)just do a databind some how
> > to
> > my dynamic control (what ever that may be - a textbox, a list box, a drop
> > down list, etc.)
> >
> > Any ideas - ?
> >
> >
> > Thanks
> >
> >
> >
> >
>
>|||OK - now I'm at work so here are some code snippets that may help (in C#):
They are used to build drop down lists in a web page with the parameter
values. This way RS takes care of the security for the parameter data. To
find out the names of the stored procs you need to get the DataSetDefinition
object and query it. I haven't yet worked out how to get it back though...
sorry. I think i tried this first and gave up, so used the parameters
collection to build the lookup data.
ReportingService rs=new ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
bool forRendering = true;
string historyID = null;
ParameterValue[] values = null;
DataSourceCredentials[] credentials = null;
ReportParameter[] parameters = null;
parameters = rs.GetReportParameters(ReportPath, historyID, forRendering,
values, credentials);
if (parameters != null)
{
foreach (ReportParameter rp in parameters)
if((rp.ValidValues!=null)||(rp.ValidValuesQueryBased))
{
DropDownList lst=new DropDownList();
foreach(ValidValue vv in rp.ValidValues)
{
ListItem item=new ListItem();
item.Text=vv.Label;
item.Value=vv.Value;
lst.Items.Add(item);
}
"Myles" wrote:
> Thank you for the reply Mary - I may need a little help yet,
> I went back and read my question and I was so involved I think I mis-stated
> my question! Do the web services expose the names of the stored procedures
> used to fill the valid values for the parameters - from your response it
> sounds as if you just use the GetReportParameters method and that returns
> everything (all of the datasets for all of the parameters) - if that's the
> case how do you separate or sort through it all...HELP!
> It was a very long weekend - and I still didn't get anything done!
>
> Thanks,
>
> "Mary Bray [MVP]" wrote:
> > I have done exactly this, but the code is at work and it is a (very) long
> > weekend.
> > You can certainly use the web services to retrieve everything - the trick to
> > getting the values you have set up from datasets that populate the possible
> > values etc is to that when you run the GetReportParameters method, make sure
> > you set the ForRendering option to true - then everything you need comes
> > back.
> >
> > Have a go and I'll post my code on Tuesday
> > --
> >
> > Mary Bray [SQL Server MVP]
> > Please reply only to newsgroups
> >
> > "Myles" <Myles@.discussions.microsoft.com> wrote in message
> > news:44942D91-7D8D-4514-91BE-E0FD9E9750FA@.microsoft.com...
> > > greetings -
> > >
> > > I am trying to set up a custom parameters page in an ASP .NET
> > > application -
> > > I am in the process of choosing between keeping the values (information I
> > > need to list the parameters for the reports, as well as the available,
> > > valid
> > > and default values for any given report) in a database or access all I
> > > need
> > > through reporting services (web service).
> > >
> > > Does anyone have any advice for setting up a Web App to run rs reports -
> > > can
> > > you get all you need from the rs web services to create a custom parameter
> > > page, or is it better to retrieve the values you need from a database?
> > >
> > > I can dynamically build the custom parm page using values from a database
> > > (dynamically list the parms for the report, fire off the sp to return
> > > valid
> > > values for the parm and set the default value) - I would like to get this
> > > going using the web services but am stuck at the point of trying to fill
> > > the
> > > valid parm values - I do have the name of the stored procedure to run to
> > > retrieve the valid values for the parm, but can't seem to figure out how
> > > to
> > > either a)get the name of the sp to run, or b)just do a databind some how
> > > to
> > > my dynamic control (what ever that may be - a textbox, a list box, a drop
> > > down list, etc.)
> > >
> > > Any ideas - ?
> > >
> > >
> > > Thanks
> > >
> > >
> > >
> > >
> >
> >
> >|||beautiful - thank you very much Mary - this will be a tremendous help. If I
figure out how to actually get the sp names I will post back ~
Hope you had a great weekend!
Thanks,
Pete
"Mary Bray [SQL Server MVP]" wrote:
> OK - now I'm at work so here are some code snippets that may help (in C#):
> They are used to build drop down lists in a web page with the parameter
> values. This way RS takes care of the security for the parameter data. To
> find out the names of the stored procs you need to get the DataSetDefinition
> object and query it. I haven't yet worked out how to get it back though...
> sorry. I think i tried this first and gave up, so used the parameters
> collection to build the lookup data.
> ReportingService rs=new ReportingService();
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> bool forRendering = true;
> string historyID = null;
> ParameterValue[] values = null;
> DataSourceCredentials[] credentials = null;
> ReportParameter[] parameters = null;
> parameters = rs.GetReportParameters(ReportPath, historyID, forRendering,
> values, credentials);
> if (parameters != null)
> {
> foreach (ReportParameter rp in parameters)
> if((rp.ValidValues!=null)||(rp.ValidValuesQueryBased))
> {
> DropDownList lst=new DropDownList();
> foreach(ValidValue vv in rp.ValidValues)
> {
> ListItem item=new ListItem();
> item.Text=vv.Label;
> item.Value=vv.Value;
> lst.Items.Add(item);
> }
>
>
> "Myles" wrote:
> > Thank you for the reply Mary - I may need a little help yet,
> >
> > I went back and read my question and I was so involved I think I mis-stated
> > my question! Do the web services expose the names of the stored procedures
> > used to fill the valid values for the parameters - from your response it
> > sounds as if you just use the GetReportParameters method and that returns
> > everything (all of the datasets for all of the parameters) - if that's the
> > case how do you separate or sort through it all...HELP!
> >
> > It was a very long weekend - and I still didn't get anything done!
> >
> >
> > Thanks,
> >
> >
> >
> > "Mary Bray [MVP]" wrote:
> >
> > > I have done exactly this, but the code is at work and it is a (very) long
> > > weekend.
> > > You can certainly use the web services to retrieve everything - the trick to
> > > getting the values you have set up from datasets that populate the possible
> > > values etc is to that when you run the GetReportParameters method, make sure
> > > you set the ForRendering option to true - then everything you need comes
> > > back.
> > >
> > > Have a go and I'll post my code on Tuesday
> > > --
> > >
> > > Mary Bray [SQL Server MVP]
> > > Please reply only to newsgroups
> > >
> > > "Myles" <Myles@.discussions.microsoft.com> wrote in message
> > > news:44942D91-7D8D-4514-91BE-E0FD9E9750FA@.microsoft.com...
> > > > greetings -
> > > >
> > > > I am trying to set up a custom parameters page in an ASP .NET
> > > > application -
> > > > I am in the process of choosing between keeping the values (information I
> > > > need to list the parameters for the reports, as well as the available,
> > > > valid
> > > > and default values for any given report) in a database or access all I
> > > > need
> > > > through reporting services (web service).
> > > >
> > > > Does anyone have any advice for setting up a Web App to run rs reports -
> > > > can
> > > > you get all you need from the rs web services to create a custom parameter
> > > > page, or is it better to retrieve the values you need from a database?
> > > >
> > > > I can dynamically build the custom parm page using values from a database
> > > > (dynamically list the parms for the report, fire off the sp to return
> > > > valid
> > > > values for the parm and set the default value) - I would like to get this
> > > > going using the web services but am stuck at the point of trying to fill
> > > > the
> > > > valid parm values - I do have the name of the stored procedure to run to
> > > > retrieve the valid values for the parm, but can't seem to figure out how
> > > > to
> > > > either a)get the name of the sp to run, or b)just do a databind some how
> > > > to
> > > > my dynamic control (what ever that may be - a textbox, a list box, a drop
> > > > down list, etc.)
> > > >
> > > > Any ideas - ?
> > > >
> > > >
> > > > Thanks
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >

No comments:

Post a Comment