Monday, March 19, 2012

Group Number

I have a table that groups on one field.
I would like the group row to show an incrementing number for each group, i.e. if there are twenty records in the dataset that are grouped into 4 groups on the report, I would like the group headers to show Group 1, Group 2, Group 3 and Group 4 respectively.
I have tried fiddling around with rownumber, but that just gives me the number of rows in the group or in the entire dataset. I can't figure a way of doing it in the SP (without using Cursors) as the grouping fields are not always the same. I have also tried fiddling around with previous but that also led nowhere.
Is there no GroupNumber property or something similar I can get at?Group on Fields!Group.Value (or something similar) and use the following
expression: =RunningValue(Fields!Group.Value, CountDistinct, Nothing)
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Another frustrated developer"
<Anotherfrustrateddeveloper@.discussions.microsoft.com> wrote in message
news:C8E2AC24-C6FD-4C60-B190-480B1A395A3B@.microsoft.com...
> I have a table that groups on one field.
> I would like the group row to show an incrementing number for each group,
i.e. if there are twenty records in the dataset that are grouped into 4
groups on the report, I would like the group headers to show Group 1, Group
2, Group 3 and Group 4 respectively.
> I have tried fiddling around with rownumber, but that just gives me the
number of rows in the group or in the entire dataset. I can't figure a way
of doing it in the SP (without using Cursors) as the grouping fields are not
always the same. I have also tried fiddling around with previous but that
also led nowhere.
> Is there no GroupNumber property or something similar I can get at?|||Small clarification:
The first parameter should be the same field used in the group expression:
Fields!<FieldName>.Value
--
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ravi Mumulla (Microsoft)" <ravimu@.online.microsoft.com> wrote in message
news:emNXUUpaEHA.2388@.TK2MSFTNGP11.phx.gbl...
> Group on Fields!Group.Value (or something similar) and use the following
> expression: =RunningValue(Fields!Group.Value, CountDistinct, Nothing)
> --
> Ravi Mumulla (Microsoft)
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Another frustrated developer"
> <Anotherfrustrateddeveloper@.discussions.microsoft.com> wrote in message
> news:C8E2AC24-C6FD-4C60-B190-480B1A395A3B@.microsoft.com...
> > I have a table that groups on one field.
> >
> > I would like the group row to show an incrementing number for each
group,
> i.e. if there are twenty records in the dataset that are grouped into 4
> groups on the report, I would like the group headers to show Group 1,
Group
> 2, Group 3 and Group 4 respectively.
> >
> > I have tried fiddling around with rownumber, but that just gives me the
> number of rows in the group or in the entire dataset. I can't figure a
way
> of doing it in the SP (without using Cursors) as the grouping fields are
not
> always the same. I have also tried fiddling around with previous but that
> also led nowhere.
> >
> > Is there no GroupNumber property or something similar I can get at?
>|||Great Job guys, works a dream.
Thanks very much.
Rich.
"Bruce Johnson [MSFT]" wrote:
> Small clarification:
> The first parameter should be the same field used in the group expression:
> Fields!<FieldName>.Value
> --
> Bruce Johnson [MSFT]
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Ravi Mumulla (Microsoft)" <ravimu@.online.microsoft.com> wrote in message
> news:emNXUUpaEHA.2388@.TK2MSFTNGP11.phx.gbl...
> > Group on Fields!Group.Value (or something similar) and use the following
> > expression: =RunningValue(Fields!Group.Value, CountDistinct, Nothing)
> >
> > --
> > Ravi Mumulla (Microsoft)
> > SQL Server Reporting Services
> >
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > "Another frustrated developer"
> > <Anotherfrustrateddeveloper@.discussions.microsoft.com> wrote in message
> > news:C8E2AC24-C6FD-4C60-B190-480B1A395A3B@.microsoft.com...
> > > I have a table that groups on one field.
> > >
> > > I would like the group row to show an incrementing number for each
> group,
> > i.e. if there are twenty records in the dataset that are grouped into 4
> > groups on the report, I would like the group headers to show Group 1,
> Group
> > 2, Group 3 and Group 4 respectively.
> > >
> > > I have tried fiddling around with rownumber, but that just gives me the
> > number of rows in the group or in the entire dataset. I can't figure a
> way
> > of doing it in the SP (without using Cursors) as the grouping fields are
> not
> > always the same. I have also tried fiddling around with previous but that
> > also led nowhere.
> > >
> > > Is there no GroupNumber property or something similar I can get at?
> >
> >
>
>

No comments:

Post a Comment