Tuesday, February 14, 2012

Breaking a dataset into chunks

Hey everyone. I'm trying to recreate some Excel reports my company has
been issuing for the last few years using Reporting Services (data is
coming from an Analysis Services cube now). The reports display
information over a retail hierarchy. Here's what I'm trying to do for
one of them: On one report issued for every entity that has children,
there are five columns of space allotted for key measures on each of
the children (and the report needs to expand to the necessary number
of pages for all children to be displayed, up to five per page). Then,
immediately next to it on each page, the same information about the
current entity and its hierarchy parents must be put in on each page.
There would be up to four columns here. At first I tried fitting this
into two matrix controls, but I quickly realized that SSRS will
process the first matrix for all records in its dataset before getting
to the second one, forcing it to start displaying it no sooner than
the last page of the first matrix. If anyone knows a brilliant way to
allow two unlike-sized datasets to be used in two matrices that can
interrupt each other to get data onto a page, by all means let me know
(I'm not holding my breath for that one though).
This brings me to my actual question. The next solution we've come up
with, as much as we don't like it, is assuming a maximum of 25
children for any entity and creating five separate pages, each one
with a matrix that pulls in a maximum of five records. This of course
probably means five datasets, unless I can set up filtering to limit
which rows from the dataset are being used for each control. So, my
question is this: can anyone suggest a good way to either A) break the
dataset into chunks of <=5 records, or B) filter the each page's
control so that it only takes the appropriate <=5 records, without
redisplaying a record that was already displayed on a previous page?
Any help would be MUCH appreciated. Thanks!On Jan 22, 11:41=A0am, adam.schm...@.gmail.com wrote:
> If anyone knows a brilliant way to
> allow two unlike-sized datasets to be used in two matrices that can
> interrupt each other to get data onto a page, by all means let me know
> (I'm not holding my breath for that one though).
If I understand your problem, you could: Put each object into a
Rectangle object, then align the Rectangles to have the same Top edge,
and align the Right edge of the left rectangle to meet the Left edge
of the right rectangle.
> So, my
> question is this: can anyone suggest a good way to either A) break the
> dataset into chunks of <=3D5 records,
If your source data is a SQL Server, then try using the ROW_Number()
OVER ( ORDER BY FIELD ) function in the statement to generate row
numbers. Then, you can group by ( RowNumber - RowNumber Mod 5 ) to
create groups of 5.
> or B) filter the each page's
> control so that it only takes the appropriate <=3D5 records, without
> redisplaying a record that was already displayed on a previous page?
You could create a group as defined in (A), then put the Group in a
List object, then go to the List's properties and check the Page Break
at End. Then put all your display stuff inside the List. There are
probably other ways of doing this.
-- Scott|||Thanks Scott! I got as far as the two rectangles idea and it almost
worked -- there was only one problem. I need to have the same four
columns of information on each page in the right matrix, whereas the
left matrix just needs to expand to the size of the dataset. This is
so that for example a district manager could look at each attribute on
any page of five stores (from the left matrix) and compare it to his
entire district, his districts region, the rest of the stores in the
same brand division, and the entire company's performance (in the
right matrix). Again, five or less stores per page. Since these are
coming from different data sets, I'm having issues getting the two
data sets to repeat the same amount of times and getting the page
breaks to happen in the right places.
This provided a great jumping-off point for me, though, and I have a
hack solution that will work, although it's not great. The second
matrix can simply be replaced by four columns of textboxes, each one
displaying a specific data point. Instead of the "parents" dataset
containing up to four records, I'll need to use four datasets, each
containing up to one. Then the textboxes can display the first value
in each of those datasets for the appropriate field. Each column of
textboxes (or all four) can then be nested in a rectangle and the
rectangle can be set to repeat with the first matrix.
Obviously, this is labor-intensive, and kind of a pain, especially
given some of the formatting constraints that are going to come up.
So... if anyone knows a way to circumvent using 4 columns, 25 text
boxes each, that still allows me to set the RepeatWith property to the
left matrix, I'm all ears.
Thanks!
On Jan 22, 11:00 am, Orne <polysilly...@.yahoo.com> wrote:
> On Jan 22, 11:41 am, adam.schm...@.gmail.com wrote:
> > If anyone knows a brilliant way to
> > allow two unlike-sized datasets to be used in two matrices that can
> > interrupt each other to get data onto a page, by all means let me know
> > (I'm not holding my breath for that one though).
> If I understand your problem, you could: Put each object into a
> Rectangle object, then align the Rectangles to have the same Top edge,
> and align the Right edge of the left rectangle to meet the Left edge
> of the right rectangle.
> > So, my
> > question is this: can anyone suggest a good way to either A) break the
> > dataset into chunks of <=5 records,
> If your source data is a SQL Server, then try using the ROW_Number()
> OVER ( ORDER BY FIELD ) function in the statement to generate row
> numbers. Then, you can group by ( RowNumber - RowNumber Mod 5 ) to
> create groups of 5.
> > or B) filter the each page's
> > control so that it only takes the appropriate <=5 records, without
> > redisplaying a record that was already displayed on a previous page?
> You could create a group as defined in (A), then put the Group in a
> List object, then go to the List's properties and check the Page Break
> at End. Then put all your display stuff inside the List. There are
> probably other ways of doing this.
> -- Scott

No comments:

Post a Comment