Tuesday, March 27, 2012

Access DataSet in Code Window

I would like to access datasets in a report from code in the code window. I
found how to access parameters from the code window but I do not see a way to
iterate through a dataset.
Thanks
Matt AdamsWhat are you trying to accomplish. Maybe there is a better (more RS way) of
accomplishing it.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Matt" <Matt@.discussions.microsoft.com> wrote in message
news:F3637F35-4FC1-45C6-82CA-67B1657A6C24@.microsoft.com...
>I would like to access datasets in a report from code in the code window.
>I
> found how to access parameters from the code window but I do not see a way
> to
> iterate through a dataset.
> Thanks
> Matt Adams|||Hi Bruce,
Thanks for your prompt reply. Here is what I am trying to accomplish.
I have textboxes on the report that list the parameters that were selected
when the report was ran (because our users just love to print for some
reason). The parameters are multi-value parameters and those values are
pulled from lookup tables into a RS dataset. If the "Select All" is
selected, then I display "All" in that parameter's textbox, otherwise I
display exactly what is selected. I currently have this working in the code
window by defining the full string of current values and comparing this
against a Join statment on the Parameter label. This works fine but if the
list of values changes at the database, I need the report to be able to
handle this in a dynamic fashion.
Thanks for your assistance.
Matt Adams
"Bruce L-C [MVP]" wrote:
> What are you trying to accomplish. Maybe there is a better (more RS way) of
> accomplishing it.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Matt" <Matt@.discussions.microsoft.com> wrote in message
> news:F3637F35-4FC1-45C6-82CA-67B1657A6C24@.microsoft.com...
> >I would like to access datasets in a report from code in the code window.
> >I
> > found how to access parameters from the code window but I do not see a way
> > to
> > iterate through a dataset.
> >
> > Thanks
> >
> > Matt Adams
>
>|||OK, you don't need to be accessing the data directly. You can do all this
with the parameters object. Just remember before writing code, expressions
are your friend. It is very rare indeed that I write code (I do in a few
cases but not often).
Here is what I do in a textbox. I do one additional thing, if they pick more
than a certain number I just say they picked more than X parameters.
Container is the name of the multi-value parameter in this example:
="Containers= " & iif(Parameters!Container.Count > 8," more than 7
Selected",Join(Parameters!Container.Value, ", "))
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Matt" <Matt@.discussions.microsoft.com> wrote in message
news:844BFAFD-2CAB-4FE6-91FE-19B1FE651FB6@.microsoft.com...
> Hi Bruce,
> Thanks for your prompt reply. Here is what I am trying to accomplish.
> I have textboxes on the report that list the parameters that were selected
> when the report was ran (because our users just love to print for some
> reason). The parameters are multi-value parameters and those values are
> pulled from lookup tables into a RS dataset. If the "Select All" is
> selected, then I display "All" in that parameter's textbox, otherwise I
> display exactly what is selected. I currently have this working in the
> code
> window by defining the full string of current values and comparing this
> against a Join statment on the Parameter label. This works fine but if
> the
> list of values changes at the database, I need the report to be able to
> handle this in a dynamic fashion.
> Thanks for your assistance.
> Matt Adams
> "Bruce L-C [MVP]" wrote:
>> What are you trying to accomplish. Maybe there is a better (more RS way)
>> of
>> accomplishing it.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Matt" <Matt@.discussions.microsoft.com> wrote in message
>> news:F3637F35-4FC1-45C6-82CA-67B1657A6C24@.microsoft.com...
>> >I would like to access datasets in a report from code in the code
>> >window.
>> >I
>> > found how to access parameters from the code window but I do not see a
>> > way
>> > to
>> > iterate through a dataset.
>> >
>> > Thanks
>> >
>> > Matt Adams
>>|||That is definately a better solution than what I am doing now with a lot less
coding. It will not be dynamic but it will be less maintenance this way.
Thanks alot.
Just for the sake of having knowledge, do you know of a way to access a RS
Dataset from the code window or by calling a referenced component? Say if I
had a need to iterate through the dataset.
Thanks again.
"Bruce L-C [MVP]" wrote:
> OK, you don't need to be accessing the data directly. You can do all this
> with the parameters object. Just remember before writing code, expressions
> are your friend. It is very rare indeed that I write code (I do in a few
> cases but not often).
> Here is what I do in a textbox. I do one additional thing, if they pick more
> than a certain number I just say they picked more than X parameters.
> Container is the name of the multi-value parameter in this example:
> ="Containers= " & iif(Parameters!Container.Count > 8," more than 7
> Selected",Join(Parameters!Container.Value, ", "))
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
>
> "Matt" <Matt@.discussions.microsoft.com> wrote in message
> news:844BFAFD-2CAB-4FE6-91FE-19B1FE651FB6@.microsoft.com...
> > Hi Bruce,
> >
> > Thanks for your prompt reply. Here is what I am trying to accomplish.
> >
> > I have textboxes on the report that list the parameters that were selected
> > when the report was ran (because our users just love to print for some
> > reason). The parameters are multi-value parameters and those values are
> > pulled from lookup tables into a RS dataset. If the "Select All" is
> > selected, then I display "All" in that parameter's textbox, otherwise I
> > display exactly what is selected. I currently have this working in the
> > code
> > window by defining the full string of current values and comparing this
> > against a Join statment on the Parameter label. This works fine but if
> > the
> > list of values changes at the database, I need the report to be able to
> > handle this in a dynamic fashion.
> >
> > Thanks for your assistance.
> >
> > Matt Adams
> >
> > "Bruce L-C [MVP]" wrote:
> >
> >> What are you trying to accomplish. Maybe there is a better (more RS way)
> >> of
> >> accomplishing it.
> >>
> >>
> >> --
> >> Bruce Loehle-Conger
> >> MVP SQL Server Reporting Services
> >>
> >> "Matt" <Matt@.discussions.microsoft.com> wrote in message
> >> news:F3637F35-4FC1-45C6-82CA-67B1657A6C24@.microsoft.com...
> >> >I would like to access datasets in a report from code in the code
> >> >window.
> >> >I
> >> > found how to access parameters from the code window but I do not see a
> >> > way
> >> > to
> >> > iterate through a dataset.
> >> >
> >> > Thanks
> >> >
> >> > Matt Adams
> >>
> >>
> >>
>
>|||You can have a custom assembly but it is not trivial. The biggest issue is
dealing with security for custom assemblies.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Matt" <Matt@.discussions.microsoft.com> wrote in message
news:8A423D93-D7E2-4DF9-AE23-78C2E67756A6@.microsoft.com...
> That is definately a better solution than what I am doing now with a lot
> less
> coding. It will not be dynamic but it will be less maintenance this way.
> Thanks alot.
> Just for the sake of having knowledge, do you know of a way to access a RS
> Dataset from the code window or by calling a referenced component? Say if
> I
> had a need to iterate through the dataset.
> Thanks again.
> "Bruce L-C [MVP]" wrote:
>> OK, you don't need to be accessing the data directly. You can do all this
>> with the parameters object. Just remember before writing code,
>> expressions
>> are your friend. It is very rare indeed that I write code (I do in a few
>> cases but not often).
>> Here is what I do in a textbox. I do one additional thing, if they pick
>> more
>> than a certain number I just say they picked more than X parameters.
>> Container is the name of the multi-value parameter in this example:
>> ="Containers= " & iif(Parameters!Container.Count > 8," more than 7
>> Selected",Join(Parameters!Container.Value, ", "))
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>>
>> "Matt" <Matt@.discussions.microsoft.com> wrote in message
>> news:844BFAFD-2CAB-4FE6-91FE-19B1FE651FB6@.microsoft.com...
>> > Hi Bruce,
>> >
>> > Thanks for your prompt reply. Here is what I am trying to accomplish.
>> >
>> > I have textboxes on the report that list the parameters that were
>> > selected
>> > when the report was ran (because our users just love to print for some
>> > reason). The parameters are multi-value parameters and those values
>> > are
>> > pulled from lookup tables into a RS dataset. If the "Select All" is
>> > selected, then I display "All" in that parameter's textbox, otherwise I
>> > display exactly what is selected. I currently have this working in the
>> > code
>> > window by defining the full string of current values and comparing this
>> > against a Join statment on the Parameter label. This works fine but if
>> > the
>> > list of values changes at the database, I need the report to be able to
>> > handle this in a dynamic fashion.
>> >
>> > Thanks for your assistance.
>> >
>> > Matt Adams
>> >
>> > "Bruce L-C [MVP]" wrote:
>> >
>> >> What are you trying to accomplish. Maybe there is a better (more RS
>> >> way)
>> >> of
>> >> accomplishing it.
>> >>
>> >>
>> >> --
>> >> Bruce Loehle-Conger
>> >> MVP SQL Server Reporting Services
>> >>
>> >> "Matt" <Matt@.discussions.microsoft.com> wrote in message
>> >> news:F3637F35-4FC1-45C6-82CA-67B1657A6C24@.microsoft.com...
>> >> >I would like to access datasets in a report from code in the code
>> >> >window.
>> >> >I
>> >> > found how to access parameters from the code window but I do not see
>> >> > a
>> >> > way
>> >> > to
>> >> > iterate through a dataset.
>> >> >
>> >> > Thanks
>> >> >
>> >> > Matt Adams
>> >>
>> >>
>> >>
>>|||Ok. Makes sense. Thanks.
"Bruce L-C [MVP]" wrote:
> You can have a custom assembly but it is not trivial. The biggest issue is
> dealing with security for custom assemblies.
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Matt" <Matt@.discussions.microsoft.com> wrote in message
> news:8A423D93-D7E2-4DF9-AE23-78C2E67756A6@.microsoft.com...
> > That is definately a better solution than what I am doing now with a lot
> > less
> > coding. It will not be dynamic but it will be less maintenance this way.
> > Thanks alot.
> >
> > Just for the sake of having knowledge, do you know of a way to access a RS
> > Dataset from the code window or by calling a referenced component? Say if
> > I
> > had a need to iterate through the dataset.
> >
> > Thanks again.
> >
> > "Bruce L-C [MVP]" wrote:
> >
> >> OK, you don't need to be accessing the data directly. You can do all this
> >> with the parameters object. Just remember before writing code,
> >> expressions
> >> are your friend. It is very rare indeed that I write code (I do in a few
> >> cases but not often).
> >>
> >> Here is what I do in a textbox. I do one additional thing, if they pick
> >> more
> >> than a certain number I just say they picked more than X parameters.
> >> Container is the name of the multi-value parameter in this example:
> >> ="Containers= " & iif(Parameters!Container.Count > 8," more than 7
> >> Selected",Join(Parameters!Container.Value, ", "))
> >>
> >> --
> >> Bruce Loehle-Conger
> >> MVP SQL Server Reporting Services
> >>
> >>
> >> "Matt" <Matt@.discussions.microsoft.com> wrote in message
> >> news:844BFAFD-2CAB-4FE6-91FE-19B1FE651FB6@.microsoft.com...
> >> > Hi Bruce,
> >> >
> >> > Thanks for your prompt reply. Here is what I am trying to accomplish.
> >> >
> >> > I have textboxes on the report that list the parameters that were
> >> > selected
> >> > when the report was ran (because our users just love to print for some
> >> > reason). The parameters are multi-value parameters and those values
> >> > are
> >> > pulled from lookup tables into a RS dataset. If the "Select All" is
> >> > selected, then I display "All" in that parameter's textbox, otherwise I
> >> > display exactly what is selected. I currently have this working in the
> >> > code
> >> > window by defining the full string of current values and comparing this
> >> > against a Join statment on the Parameter label. This works fine but if
> >> > the
> >> > list of values changes at the database, I need the report to be able to
> >> > handle this in a dynamic fashion.
> >> >
> >> > Thanks for your assistance.
> >> >
> >> > Matt Adams
> >> >
> >> > "Bruce L-C [MVP]" wrote:
> >> >
> >> >> What are you trying to accomplish. Maybe there is a better (more RS
> >> >> way)
> >> >> of
> >> >> accomplishing it.
> >> >>
> >> >>
> >> >> --
> >> >> Bruce Loehle-Conger
> >> >> MVP SQL Server Reporting Services
> >> >>
> >> >> "Matt" <Matt@.discussions.microsoft.com> wrote in message
> >> >> news:F3637F35-4FC1-45C6-82CA-67B1657A6C24@.microsoft.com...
> >> >> >I would like to access datasets in a report from code in the code
> >> >> >window.
> >> >> >I
> >> >> > found how to access parameters from the code window but I do not see
> >> >> > a
> >> >> > way
> >> >> > to
> >> >> > iterate through a dataset.
> >> >> >
> >> >> > Thanks
> >> >> >
> >> >> > Matt Adams
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>sql

No comments:

Post a Comment