Monday, March 26, 2012

How to show all the fields in a dataset.

I have a sp that returns a different dataset depending on the parameter
values, it is dyanamic sp which has different field names and also the
number of fields.
Is there a way to incorporate this in reporting services, like in .Net
we can display the dataset by just binding it to the datagrid and
letting datagrid handle the rest.
Thanks,
TonyNo. RS does not work that way. It expects a consistent number/name of
fields.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<bubaa118@.yahoo.com> wrote in message
news:1107965810.679249.274270@.c13g2000cwb.googlegroups.com...
> I have a sp that returns a different dataset depending on the parameter
> values, it is dyanamic sp which has different field names and also the
> number of fields.
> Is there a way to incorporate this in reporting services, like in .Net
> we can display the dataset by just binding it to the datagrid and
> letting datagrid handle the rest.
> Thanks,
> Tony
>|||Thanks for the prompt reply Bruce, Is there any other workaround for
the issue I have any ideas or suggestions would be great.
Thanks again,
Tony|||You can have multiple datasets in a report, each of them calling the
procedure with the appropriate parameter. This does mean the SP will get
called multiple times. Then you should be able to hide the table on the
report if there is no data. I haven't tried this but I think you can. You
still might end up with some blank lines though.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<bubaa118@.yahoo.com> wrote in message
news:1107967055.899883.298640@.f14g2000cwb.googlegroups.com...
> Thanks for the prompt reply Bruce, Is there any other workaround for
> the issue I have any ideas or suggestions would be great.
> Thanks again,
> Tony
>|||You could also at the end of your proc pivot (or is this really
unpivoting) the data. So for a table with structure
# keycol # col1 # col2 # col3 # col4 # ... # col<n> #
you would end up with
# keycolvalue # colname # colvalue #
this will have n rows for each row in the original table. You may want
to modify your proc to build that to begin with rather than pivot data
later.
then you could drop that into a matrix.
This would work fairly well if all variable columns are of the same
type. Otherwise you'd have to do some formatting in the stored
procedure.

No comments:

Post a Comment