Friday, March 30, 2012
Grouping records - HOW TO
Is there a way that I can get the same sort of output as when you create a
relationship between two tables, but with only one table?
With a dataset containing two (or more) tables that has a data relation
added, you get a resultant output (say a datagrid) that groups by the column
detailed in the relationship. When the datagrid is displayed it shows each
parent record (row) with a '+' next to it. When selected you can then
display the related child records.
I have a single table with multiple records. Let's say one field is name.
There may be multiple records for each person who is displayed in the name
field. Instead of doing a simple sort and showing all records at the same
time, I would like to have the '+', and only show the persons name once. I
could then expand that record to show all for that person.
Is this possible?
I am using VB.Net, windows display (not IE), and sql server.
Hope there is an answer out there............even if it is NO ;-)
Rgds, PhilPhil,
use
SELECT DISTINCT name FROM table
for the first DataTable and
SELECT name, other_cols_needed FROM table
for the second DataTable.
Then add a DataRelation on the name column.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Phil" <Phil@.nospam.com> wrote in message
news:ddkugr$a1h$1@.nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
> Hi,
> Is there a way that I can get the same sort of output as when you create a
> relationship between two tables, but with only one table?
> With a dataset containing two (or more) tables that has a data relation
> added, you get a resultant output (say a datagrid) that groups by the
> column detailed in the relationship. When the datagrid is displayed it
> shows each parent record (row) with a '+' next to it. When selected you
> can then display the related child records.
> I have a single table with multiple records. Let's say one field is name.
> There may be multiple records for each person who is displayed in the name
> field. Instead of doing a simple sort and showing all records at the same
> time, I would like to have the '+', and only show the persons name once. I
> could then expand that record to show all for that person.
> Is this possible?
> I am using VB.Net, windows display (not IE), and sql server.
> Hope there is an answer out there............even if it is NO ;-)
> Rgds, Phil
>|||Dejan,
Thanks for the response but I only have ONE table, as stated. If I had two
tables then it wouldn't be a problem for me. Can it be done with one table?
Cheers, Phil
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
message news:%23r89FNBoFHA.4028@.TK2MSFTNGP10.phx.gbl...
> Phil,
> use
> SELECT DISTINCT name FROM table
> for the first DataTable and
> SELECT name, other_cols_needed FROM table
> for the second DataTable.
> Then add a DataRelation on the name column.
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> www.SolidQualityLearning.com
> "Phil" <Phil@.nospam.com> wrote in message
> news:ddkugr$a1h$1@.nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
>|||> Thanks for the response but I only have ONE table, as stated. If I had two
> tables then it wouldn't be a problem for me. Can it be done with one
> table?
You can use two selects to fill two DataTable objects from a single SQL
table.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
Grouping question...
Hi,
I am migrating some reports from MS Access2003 to SQL 2005 Reporting Services.
I have a dataset which contains columns for Sex, Age, Name etc... I firstly display the contents of this dataset in a table and this is fine. I also need to display a table of the breakdown of the age and sex. E.G:-
< 16yrs 16yrs-24yrs 25yrs-64yrs 65yrs-74yrs 75yrs-84yrs >=85yrs
Male x x x x x x
Female x x x x x x
Does anyone know if this is possible. I was going to use a DCount function (As found in access) but I can not find it in SRS. What is thet best way to produce this result?
Thanks in advance for your time
Peter Tewkesbury
BlueFlower Limited
Conditional aggregation can be achieved as follows:
=Sum(iif(Fields!Age.Value >= 25 AND Fields!Age.Value < 65, 1, 0))
-- Robert
sqlGrouping Question
I have data from a dataset like this:
Dte Activity Agent Hours
-- - -
5/1/2007 activity1 agent1 11.0
5/1/2007 activity1 agent2 5.0
How would I group this data in a Table to display like this:
5/1/2007 activity1 agent1 11.0
agent2 5.0
What i've tried so far:
1) Using previous() to blank out Dte and Activity columns if previous is same as current. Does not work becuase agent2 shows many lines below agent1 depending on the size of activity(this field could be very long)
2) Grouping by Dte and Activity would not concat agent field and/ or hours field into one string.
3) Don't want to group concat in database if i don't have to. This makes suming values difficult on the reporting side.
Any ideas?
Thx
clarification:1st grouping is date
2nd grouping is activity number
So why not just have two groupings?
(how do you tables in these forums?)
assume below is a grid 4 cols by 3 rows, representing a table in RS
where the top rop is "grouping one"
second row is "grouping two"
third row is detail
col1, row1: =fields!DateValue
col2,row2: = fields!ActivityValue
col3,row3: = fields!OtherData1.Value
col4,row3: = fields!OtherData2.Value
...etcsql
Wednesday, March 28, 2012
grouping over multiple datasets
So far, I'm not having any luck getting this to work. Can anyone tell me if what I'm trying to do is possible and shed some light if it is?
You either need to combine these two data sets in the query (UNION with a filter will probably work) or use subreports. Data regions to not support multiple 1:manys.
grouping over multiple datasets
So far, I'm not having any luck getting this to work. Can anyone tell me if what I'm trying to do is possible and shed some light if it is?
You either need to combine these two data sets in the query (UNION with a filter will probably work) or use subreports. Data regions to not support multiple 1:manys.
Monday, March 26, 2012
Grouping in Cube's dataset, Please Help
Injury Class has four members [Injury A] [Injury B] [Injury c] [Injury d]
I want to get the Person count for each one individually, in seperate
columns. So it would look like this
[Person Count A] [Person Count b] [Person Count C] [Person Count d]
125 254 4 1245
441 11 21 24
454 57 12 42
I want this all in One single Dataset. So that when i put it into a table, i dont get errors about being outside the scope, also everything will be lined
up correctly. Please keep in mind, im new to mdx, i tried some code, but the
stuff i tried didnt work. Is there a way to do this as a calculated member?
how so? Anywa help will be gratelly appriciated. Thanks!You cant do this
grouping data to a field
Im doing a report wich is causing me some trouble:
Im doing a dataset selecting all values regarding the company, and then
im mapping the fields to textboxes in my VS designer. This should
result in a list with all my customers and their data.
Now below each customer i would like to place a table holding data from
another dataset, but i only want the data in the table to correspond to
the company just above the table.
I have placed both the customer data and the table in a list item, but
the problem seems to be the data in the table. I either get evrything
each time for all customers, or i only get the first customer data
below each customer.
Can anyone tell me how i can make this work.
Thanks
JimmyHi
I think there are two ways to solve this
first and the easiest :
get all the data in one dataset and use grouping facility in the reporting
services to group the data
second :
use sub report to build the details and pass the company id from the
parent report to the sub report
Joe
"Jimbo" wrote:
> Hey
> Im doing a report wich is causing me some trouble:
> Im doing a dataset selecting all values regarding the company, and then
> im mapping the fields to textboxes in my VS designer. This should
> result in a list with all my customers and their data.
> Now below each customer i would like to place a table holding data from
> another dataset, but i only want the data in the table to correspond to
> the company just above the table.
> I have placed both the customer data and the table in a list item, but
> the problem seems to be the data in the table. I either get evrything
> each time for all customers, or i only get the first customer data
> below each customer.
> Can anyone tell me how i can make this work.
> Thanks
> Jimmy
>|||Hey Joe
Ok, its not optimal, but it got the job done.
Im actually using a combination of the two.
Your posting lead me on the way though :)
Thanks
Jimmy
Friday, March 23, 2012
Grouping by daterange
propnum rundate genregroup totalcharges
-- --- -- --
16 2005-05-27 00:00:00.000 A 131.8800
16 2005-05-27 00:00:00.000 L 239.7600
16 2005-05-27 00:00:00.000 T 27.9800
16 2005-05-27 00:00:00.000 W 21.9900
16 2005-05-28 00:00:00.000 A 373.6600
16 2005-05-28 00:00:00.000 L 159.8400
.....
16 2005-08-01 00:00:00.000 T 41.9700
16 2005-08-02 00:00:00.000 W 21.9900
16 2005-08-02 00:00:00.000 A 461.5800
What I'm looking to do, is do a count on all the items by w
. I'mcurrently doing it by day, so it looks something like this...
2005-11-28 00:00:00.000 191
2005-11-27 00:00:00.000 463
2005-11-26 00:00:00.000 471
2005-11-25 00:00:00.000 474
2005-11-24 00:00:00.000 466
2005-11-23 00:00:00.000 453
2005-11-22 00:00:00.000 433
2005-11-21 00:00:00.000 453
so I have a count of the items purchaced by day. I'd like to figure how to
do it by w
, so it would look something like this:2005-11-06 - 2005-11-12 191
2005-11-13 - 2005-11-19 310
2005-11-20 - 2005-11-26 440
2005-11-27 - 2005-12-03 101
2005-12-04 - 2005-12-10 96
2005-12-11 - 2005-12-17 317
...is there a way to do this using SQL?
Thanks in advance for the info!Casey wrote:
> ...is there a way to do this using SQL?
Of course ;)
Select min(dateColumn) as BeginDate, max(dateColumn) as EndDate,
count(*) as Total from Table
group by Year(dateColumn), datepart(w
, dateColumn)The year(dateColumn) is needed when your data spans more than 1 year so
best to include it.
HTH,
Stijn Verrept.|||WOW! That worked great. Except the group only seems to be in 6 day groups,
not the expected 7... here's my query...
SELECT TOP 10 min(rundate) as beginDate, max(rundate) as EndDate,
count(*) as Total
FROM dbo.SiteDay
where rundate between '09/04/2005' and '11/30/2005'
group by Year(rundate), datepart(w
, rundate)order by beginDate
...and here's the result...
beginDate EndDate Total
-- -- --
2005-09-04 00:00:00.000 2005-09-10 00:00:00.000 3191
2005-09-11 00:00:00.000 2005-09-17 00:00:00.000 3221
2005-09-18 00:00:00.000 2005-09-24 00:00:00.000 3196
2005-09-25 00:00:00.000 2005-10-01 00:00:00.000 3235
2005-10-02 00:00:00.000 2005-10-08 00:00:00.000 3195
2005-10-09 00:00:00.000 2005-10-15 00:00:00.000 3220
2005-10-16 00:00:00.000 2005-10-22 00:00:00.000 3228
2005-10-23 00:00:00.000 2005-10-29 00:00:00.000 3249
2005-10-30 00:00:00.000 2005-11-05 00:00:00.000 3285
2005-11-06 00:00:00.000 2005-11-12 00:00:00.000 3270
(10 row(s) affected)
...any idea why this might be?
"Stijn Verrept" wrote:
> Casey wrote:
>
> Of course ;)
> Select min(dateColumn) as BeginDate, max(dateColumn) as EndDate,
> count(*) as Total from Table
> group by Year(dateColumn), datepart(w
, dateColumn)> The year(dateColumn) is needed when your data spans more than 1 year so
> best to include it.
> --
> HTH,
> Stijn Verrept.
>|||Casey wrote:
> WOW! That worked great. Except the group only seems to be in 6 day
> groups, not the expected 7... here's my query...
> ...and here's the result...
> beginDate EndDate Total
> -- -- --
> 2005-09-04 00:00:00.000 2005-09-10 00:00:00.000 3191
> 2005-09-11 00:00:00.000 2005-09-17 00:00:00.000 3221
> 2005-09-18 00:00:00.000 2005-09-24 00:00:00.000 3196
> 2005-09-25 00:00:00.000 2005-10-01 00:00:00.000 3235
> 2005-10-02 00:00:00.000 2005-10-08 00:00:00.000 3195
> 2005-10-09 00:00:00.000 2005-10-15 00:00:00.000 3220
> 2005-10-16 00:00:00.000 2005-10-22 00:00:00.000 3228
> 2005-10-23 00:00:00.000 2005-10-29 00:00:00.000 3249
> 2005-10-30 00:00:00.000 2005-11-05 00:00:00.000 3285
> 2005-11-06 00:00:00.000 2005-11-12 00:00:00.000 3270
What do you mean?
From 2005-09-04 till 2005-09-10 is 7 days. If you want the next day
included as well you should do:
SELECT TOP 10 min(rundate) as beginDate, max(rundate) + 1 as
EndDate,
count(*) as Total
FROM dbo.SiteDay
where rundate between '09/04/2005' and '11/30/2005'
group by Year(rundate), datepart(w
, rundate)order by beginDate
Kind regards,
Stijn Verrept.|||"Casey" <Casey@.discussions.microsoft.com> wrote in message
news:8425A074-5F7D-471C-9909-254B3B621158@.microsoft.com...
> WOW! That worked great. Except the group only seems to be in 6 day
groups,
> not the expected 7... here's my query...
<snip>
> ...and here's the result...
> beginDate EndDate Total
> -- -- --
> 2005-09-04 00:00:00.000 2005-09-10 00:00:00.000 3191
> 2005-09-11 00:00:00.000 2005-09-17 00:00:00.000 3221
<snip>
> 2005-10-30 00:00:00.000 2005-11-05 00:00:00.000 3285
> 2005-11-06 00:00:00.000 2005-11-12 00:00:00.000 3270
> (10 row(s) affected)
> ...any idea why this might be?
>
Casey,
Your own sample desired results shows the same thing:
2005-11-06 - 2005-11-12 191
<snip>
2005-12-11 - 2005-12-17 317
The periods noted are 7 days in both cases.
Sincerely,
Chris O.sql
grouping and sorting in matrix control
purpose of this discussion with 2 columns. From the server all the data is
sorted first by column 1 and then by column 2 so that the resultset looks
like the following:
column1, column2, column3
a, 1/1/2007, 10
a, 2/1/2007, 30
a, 3/1/2007, 15
b, 10/1/2006, 5
b, 11/1/2006, 1
b, 12/1/2006, 100
b, 1/1/2007, 10
b, 2/1/2007, 9
c, 11/1/2006, 22
c, 12/1/2006, 33
c, 1/1/2007, 44
When I put this data into a matrix with the dates making the columns and
column1 values for each row I get the following
1/1/2007 2/1/2007 3/1/2007 10/1/2006 11/1/2006 12/1/2006
a 10 30 15
b 10 9 5 1
100
c 44 22
33
what I want is the following:
10/1/2006 11/1/2006 12/1/2006 1/1/2007 2/1/2007 3/1/2007
a 10
30 15
b 5 1 100 10 9
c 22 33 44
With the dates sorted. I know I can do it by changing the stored proc but
that opens up all sorts of issues with other things. Is there any way to get
the data looking like I want using reporting services and not modifying the
stored proc?
thanksOn Feb 28, 2:11 pm, Brian <B...@.discussions.microsoft.com> wrote:
> I have a dataset returned from sql server that can be represented for the
> purpose of this discussion with 2 columns. From the server all the data is
> sorted first by column 1 and then by column 2 so that the resultset looks
> like the following:
> column1, column2, column3
> a, 1/1/2007, 10
> a, 2/1/2007, 30
> a, 3/1/2007, 15
> b, 10/1/2006, 5
> b, 11/1/2006, 1
> b, 12/1/2006, 100
> b, 1/1/2007, 10
> b, 2/1/2007, 9
> c, 11/1/2006, 22
> c, 12/1/2006, 33
> c, 1/1/2007, 44
> When I put this data into a matrix with the dates making the columns and
> column1 values for each row I get the following
> 1/1/2007 2/1/2007 3/1/2007 10/1/2006 11/1/2006 12/1/2006
> a 10 30 15
> b 10 9 5 1
> 100
> c 44 22
> 33
> what I want is the following:
> 10/1/2006 11/1/2006 12/1/2006 1/1/2007 2/1/2007 3/1/2007
> a 10
> 30 15
> b 5 1 100 10 9
> c 22 33 44
> With the dates sorted. I know I can do it by changing the stored proc but
> that opens up all sorts of issues with other things. Is there any way to get
> the data looking like I want using reporting services and not modifying the
> stored proc?
> thanks
>From your results, it looks like column2 is sorting aphabetically (I'm
assuming that column2 is not defined as a datetime field in the report
or dataset). You should be able to use the conversion function CDate()
in your sort expression. Something like this should work: CDate(Fields!
column2.Value) and the direction should be ascending. Hope this helps.
Regards,
Enrique Martinez
Sr. SQL Server Developer
Monday, March 19, 2012
Group Filter Not Working
I am trying to set up a VERY simple group filter expression and I'm running into problems. What I want to do is display all rows where a date column matches a parameter passed to the report. I'm setting the filter up using something like this:
Expression Operator Value
=Fields!SampleDate = =Parameters!DateParam
I keep getting the following error:
Processing Errors
Value cannot be null.
Parameter name: value
OK
I know I'm probably doing something wrong. The only filter that I could get to not give the error is 1=1. LOL. Please help!You may want to try this approach:
Filter expression:
=(Fields!SampleDate.Value = Parameters!DateParam.Value)
Operator:
=
Filter Value:
=True
-- Robert
Group Filter doesn't work as expected
Job # (Group H2) Rating
Rating is a "Calculated" field in the Dataset.
I put a filter on Job# (Group H2) to only include Ratings > 25%
Results:
Job#'s are filtered properly and every job < 25% does NOT show. HOWEVER,
the AVG (of all Ratings) ignores the Group 2 filter and includes every job
even those with a rating < 25%.
How can I get the "Avg Rating" to also only average those ratings according
to the group 2 filter I setup?
mythreadsHi,
Try setting up th filter this way. Write the expression return a true/false
value:
For expression use this (or similar): Job# > 25%
For Operator use: =For Value use: True
HTH!
Kind regards - Fred|||Hi,
Try setting up th filter this way. Write the expression return a true/false
value:
For expression use this (or similar): Job# > 25%
For Operator use: =For Value use: =True (*** CORRECTED FROM LAST POST***)
HTH!
Kind regards - Fred|||Thanks Fred for responding.
Your suggestion produced the same results. After further digging we solved
this original problem by putting the Filter on the "Dataset" and not the
report. I didn't know you could do this.
When I put the filter on "Group 2" header, "Group 2" detail was correct, but
"Group 1" header ignored the filtering in "Group 2" and used the raw Dataset
information.
When we put the filter on the dataset, it applied to both Group 1 and Group
2.
Thanks again.
"Fred Block" wrote:
> Hi,
> Try setting up th filter this way. Write the expression return a true/false
> value:
> For expression use this (or similar): Job# > 25%
> For Operator use: => For Value use: =True (*** CORRECTED FROM LAST POST***)
> HTH!
> Kind regards - Fred
>
>
Monday, March 12, 2012
Group chart by month
the dataset asking for a machine number. The date range is hard coded
in the query for now.
This is my table's basic data...
Machine | Performance | DateTime
____________________________
1125 | 60 | 11/16/06
1125 | 45 | 12/01/06
1125 | 35 | 12/15/06
The results give me all the machines details from sept06 through
feb07. The series is the machine, Y axis is the performace and the X
Axis is the date formated by MM/YY
Right now the chart shows me 3 records. one for 11/06 and two for
12/06. Each record has a bar for the proper performance number.
What I need is 2 records.
11/06 and the bar will represent the avg for all Nov records.
12/06 and the bar will represent the avg for all Dec records.
I'm not sure if I have to change the dataset query or adjust the
groupings or whatever in the table. I'm lost right now."Bruce Lawrence" <BL32375@.gmail.com> wrote in message
news:1170436640.424961.261770@.p10g2000cwp.googlegroups.com...
>I have a really basic chart that pulls data from a SQL
>table. I have
> the dataset asking for a machine number. The date range
> is hard coded
> in the query for now.
> This is my table's basic data...
> Machine | Performance | DateTime
> ____________________________
> 1125 | 60 | 11/16/06
> 1125 | 45 | 12/01/06
> 1125 | 35 | 12/15/06
> The results give me all the machines details from sept06
> through
> feb07. The series is the machine, Y axis is the
> performace and the X
> Axis is the date formated by MM/YY
> Right now the chart shows me 3 records. one for 11/06 and
> two for
> 12/06. Each record has a bar for the proper performance
> number.
> What I need is 2 records.
> 11/06 and the bar will represent the avg for all Nov
> records.
> 12/06 and the bar will represent the avg for all Dec
> records.
> I'm not sure if I have to change the dataset query or
> adjust the
> groupings or whatever in the table. I'm lost right now.
>
I suggest you change the query. You don't mention a primary
key. You need one. You can then filter the data in your SQL
query. May I suggest you ask this question in one of the SQL
Server newsgroups (such as
microsoft.public.sqlserver.newusers, or
microsoft.public.sqlserver.programming) and give them your
full table structure and the query you are using. Include an
example of the results you want and the incorrect results
you are getting now.
Hope this helps.
Ron.
Friday, March 9, 2012
Group By Row
be done, but here is what I have.
My dataset looks like the following:
JobNumber Invoice Code Property PropertyValue Cost
071201 61556 Area
101 10.00
071201 61556 Cost Center
1101020 10.00
071201 61556 Equipment #
23R05 10.00
I want my report to look like this:
071201
61556
Area
Cost Center
Equipment #
Cost
Is there a way?Maybe you can use the case function but I'm not sure.
SELECT JobNumber, Invoice Code,
CASE Property
WHEN 'Area'
THEN 'Area' AS Area
WHEN 'Cost Center'
THEN 'Cost Center' AS CC
WHEN 'Equipment #'
THEN 'Equipment #' AS EQUIP
ELSE
etc...
END
So you gonna have different ALIAS FLD from the same physical fld.
I repeat that I didn't test it.
If not maybe using crosstable may solve ur problem.
Let me know if it works
Julien
"TCogan" <tcogan@.starcon.org> wrote in message
news:1174668240.221027.226060@.b75g2000hsg.googlegroups.com...
>I am looking for a way to group on a row. I am not sure that this can
> be done, but here is what I have.
> My dataset looks like the following:
> JobNumber Invoice Code Property PropertyValue Cost
> 071201 61556 Area
> 101 10.00
> 071201 61556 Cost Center
> 1101020 10.00
> 071201 61556 Equipment #
> 23R05 10.00
>
> I want my report to look like this:
> 071201
> 61556
> Area
> Cost Center
> Equipment #
> Cost
> Is there a way?
>|||Grouping by row can be done with toggling and visible which uses a + sign to
expand and contract , the same method can be used to display all at once.
Amarnath, MCTS
"TCogan" wrote:
> I am looking for a way to group on a row. I am not sure that this can
> be done, but here is what I have.
> My dataset looks like the following:
> JobNumber Invoice Code Property PropertyValue Cost
> 071201 61556 Area
> 101 10.00
> 071201 61556 Cost Center
> 1101020 10.00
> 071201 61556 Equipment #
> 23R05 10.00
>
> I want my report to look like this:
> 071201
> 61556
> Area
> Cost Center
> Equipment #
> Cost
> Is there a way?
>
Sunday, February 26, 2012
Group By Consecutive Values
ShiftStartDate, ShiftEndDate, NameID, Name, AbsenceCode
1-Jan 07:00 1-Jan 15:00 00001 Fred S
2-Jan 07:00 2-Jan 15:00 00001 Fred S
3-Jan 07:00 3-Jan 15:00 00001 Fred
4-Jan 07:00 4-Jan 15:00 00001 Fred S
5-Jan 07:00 5-Jan 15:00 00001 Fred S
6-Jan 07:00 6-Jan 15:00 00001 Fred
1-Jan 07:00 1-Jan 15:00 00002 Jane
2-Jan 07:00 2-Jan 15:00 00002 Jane S
3-Jan 07:00 3-Jan 15:00 00002 Jane S
4-Jan 07:00 4-Jan 15:00 00002 Jane S
5-Jan 07:00 5-Jan 15:00 00002 Jane S
6-Jan 07:00 6-Jan 15:00 00002 Jane
I would like to group by consecutive absence codes to generate a report
like:
Fred had 2 occurrences of AbsenceCode S
1-Jan 07:00 to 2-Jan 15:00
4-Jan 07:00 to 5-Jan 15:00
Jane had 1 occurrence of AbsenceCode S
2-Jan 07:00 to 5-Jan 15:00
I have many more codes, and many more records, How can I group by each
occurrence like this?
I've tried using RunningValue with Previous(AbsenceCode) but RS won't allow
nested aggregate functions.
Thanks in advance,
N.Create two groups - one on Name and another one on AbsenceCode. See the
attached example that goes against local pubs database.
<?xml version="1.0" encoding="utf-8"?>
<Report
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefini
tion"
xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<RightMargin>1in</RightMargin>
<Body>
<ReportItems>
<Table Name="table1">
<Height>1in</Height>
<Style />
<Header>
<TableRows>
<TableRow>
<Height>0.25in</Height>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox4">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<TextDecoration>Underline</TextDecoration>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
<FontWeight>700</FontWeight>
</Style>
<ZIndex>15</ZIndex>
<rd:DefaultName>textbox4</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>state</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox3">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<TextDecoration>Underline</TextDecoration>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
<FontWeight>700</FontWeight>
</Style>
<ZIndex>14</ZIndex>
<rd:DefaultName>textbox3</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>city</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox1">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<TextDecoration>Underline</TextDecoration>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
<FontWeight>700</FontWeight>
</Style>
<ZIndex>13</ZIndex>
<rd:DefaultName>textbox1</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>Name</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox2">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<TextDecoration>Underline</TextDecoration>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
<FontWeight>700</FontWeight>
</Style>
<ZIndex>12</ZIndex>
<rd:DefaultName>textbox2</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>address</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
</TableRow>
</TableRows>
</Header>
<Details>
<TableRows>
<TableRow>
<Height>0.25in</Height>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="state">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>3</ZIndex>
<rd:DefaultName>state</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="city">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>2</ZIndex>
<rd:DefaultName>city</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="au_fname">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>1</ZIndex>
<rd:DefaultName>au_fname</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>=Fields!au_fname.Value & " " &
Fields!au_lname.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="address">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<rd:DefaultName>address</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>=Fields!address.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
</TableRow>
</TableRows>
</Details>
<DataSetName>pubs</DataSetName>
<Width>5.375in</Width>
<TableGroups>
<TableGroup>
<Header>
<TableRows>
<TableRow>
<Height>0.25in</Height>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox12">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>11</ZIndex>
<rd:DefaultName>textbox12</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>=Fields!state.Value & " [" &
RunningValue(Fields!state.Value, Count, "table1_Group1") & "
authors]"</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox11">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>10</ZIndex>
<rd:DefaultName>textbox11</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox5">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>9</ZIndex>
<rd:DefaultName>textbox5</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox6">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>8</ZIndex>
<rd:DefaultName>textbox6</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
</TableRow>
</TableRows>
</Header>
<Grouping Name="table1_Group1">
<GroupExpressions>
<GroupExpression>=Fields!state.Value</GroupExpression>
</GroupExpressions>
</Grouping>
</TableGroup>
<TableGroup>
<Header>
<TableRows>
<TableRow>
<Height>0.25in</Height>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox13">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>7</ZIndex>
<rd:DefaultName>textbox13</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox14">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>6</ZIndex>
<rd:DefaultName>textbox14</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>=Fields!city.Value & " [" &
RunningValue(Fields!city.Value, Count, "table1_Group2") & "
authors]"</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox15">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>5</ZIndex>
<rd:DefaultName>textbox15</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox16">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<FontSize>8pt</FontSize>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>4</ZIndex>
<rd:DefaultName>textbox16</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
</TableRow>
</TableRows>
</Header>
<Grouping Name="table1_Group2">
<GroupExpressions>
<GroupExpression>=Fields!city.Value</GroupExpression>
</GroupExpressions>
<Parent>=Fields!state.Value</Parent>
</Grouping>
</TableGroup>
</TableGroups>
<TableColumns>
<TableColumn>
<Width>1.625in</Width>
</TableColumn>
<TableColumn>
<Width>1.375in</Width>
</TableColumn>
<TableColumn>
<Width>1.25in</Width>
</TableColumn>
<TableColumn>
<Width>1.125in</Width>
</TableColumn>
</TableColumns>
</Table>
</ReportItems>
<Style />
<Height>4.75in</Height>
</Body>
<TopMargin>1in</TopMargin>
<DataSources>
<DataSource Name="pubs">
<rd:DataSourceID>d743d813-756c-4688-850b-f2e6deda54b0</rd:DataSourceID>
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>initial catalog=pubs</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
</DataSource>
</DataSources>
<Width>7.125in</Width>
<DataSets>
<DataSet Name="pubs">
<Fields>
<Field Name="au_id">
<DataField>au_id</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="au_lname">
<DataField>au_lname</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="au_fname">
<DataField>au_fname</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="phone">
<DataField>phone</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="address">
<DataField>address</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="city">
<DataField>city</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="state">
<DataField>state</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="zip">
<DataField>zip</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="contract">
<DataField>contract</DataField>
<rd:TypeName>System.Boolean</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>pubs</DataSourceName>
<CommandText>select * from authors</CommandText>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
</Query>
</DataSet>
</DataSets>
<LeftMargin>1in</LeftMargin>
<rd:SnapToGrid>true</rd:SnapToGrid>
<rd:DrawGrid>true</rd:DrawGrid>
<rd:ReportID>7a57b47c-d471-411b-abea-bc7acc3f1a16</rd:ReportID>
<BottomMargin>1in</BottomMargin>
<Language>en-US</Language>
</Report>
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Nytr0x" <nytr0x@.yahoo.com> wrote in message
news:%23iNlXG0aEHA.3792@.TK2MSFTNGP09.phx.gbl...
> Hi I've been puzzling over this one for ages, Imagine a dataset like:
> ShiftStartDate, ShiftEndDate, NameID, Name, AbsenceCode
> 1-Jan 07:00 1-Jan 15:00 00001 Fred S
> 2-Jan 07:00 2-Jan 15:00 00001 Fred S
> 3-Jan 07:00 3-Jan 15:00 00001 Fred
> 4-Jan 07:00 4-Jan 15:00 00001 Fred S
> 5-Jan 07:00 5-Jan 15:00 00001 Fred S
> 6-Jan 07:00 6-Jan 15:00 00001 Fred
> 1-Jan 07:00 1-Jan 15:00 00002 Jane
> 2-Jan 07:00 2-Jan 15:00 00002 Jane S
> 3-Jan 07:00 3-Jan 15:00 00002 Jane S
> 4-Jan 07:00 4-Jan 15:00 00002 Jane S
> 5-Jan 07:00 5-Jan 15:00 00002 Jane S
> 6-Jan 07:00 6-Jan 15:00 00002 Jane
> I would like to group by consecutive absence codes to generate a report
> like:
> Fred had 2 occurrences of AbsenceCode S
> 1-Jan 07:00 to 2-Jan 15:00
> 4-Jan 07:00 to 5-Jan 15:00
> Jane had 1 occurrence of AbsenceCode S
> 2-Jan 07:00 to 5-Jan 15:00
> I have many more codes, and many more records, How can I group by each
> occurrence like this?
> I've tried using RunningValue with Previous(AbsenceCode) but RS won't
allow
> nested aggregate functions.
> Thanks in advance,
> N.
>|||I haven't had chance to test your example yet. But wouldn't this just group
each AbsenceCode for each Name? In the example given I want two groups for
the AbsenceCode S for Fred and 1 group for Jane.
Thanks,
N
"Ravi Mumulla (Microsoft)" <ravimu@.online.microsoft.com> wrote in message
news:%23VsZSq0aEHA.2544@.TK2MSFTNGP10.phx.gbl...
> Create two groups - one on Name and another one on AbsenceCode. See the
> attached example that goes against local pubs database.
> <?xml version="1.0" encoding="utf-8"?>
> <Report
>
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefini
> tion"
>
xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
> <RightMargin>1in</RightMargin>
> <Body>
> <ReportItems>
> <Table Name="table1">
> <Height>1in</Height>
> <Style />
> <Header>
> <TableRows>
> <TableRow>
> <Height>0.25in</Height>
> <TableCells>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox4">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <TextDecoration>Underline</TextDecoration>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> <FontWeight>700</FontWeight>
> </Style>
> <ZIndex>15</ZIndex>
> <rd:DefaultName>textbox4</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>state</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox3">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <TextDecoration>Underline</TextDecoration>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> <FontWeight>700</FontWeight>
> </Style>
> <ZIndex>14</ZIndex>
> <rd:DefaultName>textbox3</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>city</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox1">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <TextDecoration>Underline</TextDecoration>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> <FontWeight>700</FontWeight>
> </Style>
> <ZIndex>13</ZIndex>
> <rd:DefaultName>textbox1</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>Name</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox2">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <TextDecoration>Underline</TextDecoration>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> <FontWeight>700</FontWeight>
> </Style>
> <ZIndex>12</ZIndex>
> <rd:DefaultName>textbox2</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>address</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> </TableCells>
> </TableRow>
> </TableRows>
> </Header>
> <Details>
> <TableRows>
> <TableRow>
> <Height>0.25in</Height>
> <TableCells>
> <TableCell>
> <ReportItems>
> <Textbox Name="state">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>3</ZIndex>
> <rd:DefaultName>state</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value />
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="city">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>2</ZIndex>
> <rd:DefaultName>city</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value />
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="au_fname">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>1</ZIndex>
> <rd:DefaultName>au_fname</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>=Fields!au_fname.Value & " " &
> Fields!au_lname.Value</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="address">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <rd:DefaultName>address</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>=Fields!address.Value</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> </TableCells>
> </TableRow>
> </TableRows>
> </Details>
> <DataSetName>pubs</DataSetName>
> <Width>5.375in</Width>
> <TableGroups>
> <TableGroup>
> <Header>
> <TableRows>
> <TableRow>
> <Height>0.25in</Height>
> <TableCells>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox12">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>11</ZIndex>
> <rd:DefaultName>textbox12</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>=Fields!state.Value & " [" &
> RunningValue(Fields!state.Value, Count, "table1_Group1") & "
> authors]"</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox11">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>10</ZIndex>
> <rd:DefaultName>textbox11</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value />
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox5">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>9</ZIndex>
> <rd:DefaultName>textbox5</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value />
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox6">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>8</ZIndex>
> <rd:DefaultName>textbox6</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value />
> </Textbox>
> </ReportItems>
> </TableCell>
> </TableCells>
> </TableRow>
> </TableRows>
> </Header>
> <Grouping Name="table1_Group1">
> <GroupExpressions>
> <GroupExpression>=Fields!state.Value</GroupExpression>
> </GroupExpressions>
> </Grouping>
> </TableGroup>
> <TableGroup>
> <Header>
> <TableRows>
> <TableRow>
> <Height>0.25in</Height>
> <TableCells>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox13">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>7</ZIndex>
> <rd:DefaultName>textbox13</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value />
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox14">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>6</ZIndex>
> <rd:DefaultName>textbox14</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>=Fields!city.Value & " [" &
> RunningValue(Fields!city.Value, Count, "table1_Group2") & "
> authors]"</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox15">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>5</ZIndex>
> <rd:DefaultName>textbox15</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value />
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox16">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <FontSize>8pt</FontSize>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>4</ZIndex>
> <rd:DefaultName>textbox16</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value />
> </Textbox>
> </ReportItems>
> </TableCell>
> </TableCells>
> </TableRow>
> </TableRows>
> </Header>
> <Grouping Name="table1_Group2">
> <GroupExpressions>
> <GroupExpression>=Fields!city.Value</GroupExpression>
> </GroupExpressions>
> <Parent>=Fields!state.Value</Parent>
> </Grouping>
> </TableGroup>
> </TableGroups>
> <TableColumns>
> <TableColumn>
> <Width>1.625in</Width>
> </TableColumn>
> <TableColumn>
> <Width>1.375in</Width>
> </TableColumn>
> <TableColumn>
> <Width>1.25in</Width>
> </TableColumn>
> <TableColumn>
> <Width>1.125in</Width>
> </TableColumn>
> </TableColumns>
> </Table>
> </ReportItems>
> <Style />
> <Height>4.75in</Height>
> </Body>
> <TopMargin>1in</TopMargin>
> <DataSources>
> <DataSource Name="pubs">
> <rd:DataSourceID>d743d813-756c-4688-850b-f2e6deda54b0</rd:DataSourceID>
> <ConnectionProperties>
> <DataProvider>SQL</DataProvider>
> <ConnectString>initial catalog=pubs</ConnectString>
> <IntegratedSecurity>true</IntegratedSecurity>
> </ConnectionProperties>
> </DataSource>
> </DataSources>
> <Width>7.125in</Width>
> <DataSets>
> <DataSet Name="pubs">
> <Fields>
> <Field Name="au_id">
> <DataField>au_id</DataField>
> <rd:TypeName>System.String</rd:TypeName>
> </Field>
> <Field Name="au_lname">
> <DataField>au_lname</DataField>
> <rd:TypeName>System.String</rd:TypeName>
> </Field>
> <Field Name="au_fname">
> <DataField>au_fname</DataField>
> <rd:TypeName>System.String</rd:TypeName>
> </Field>
> <Field Name="phone">
> <DataField>phone</DataField>
> <rd:TypeName>System.String</rd:TypeName>
> </Field>
> <Field Name="address">
> <DataField>address</DataField>
> <rd:TypeName>System.String</rd:TypeName>
> </Field>
> <Field Name="city">
> <DataField>city</DataField>
> <rd:TypeName>System.String</rd:TypeName>
> </Field>
> <Field Name="state">
> <DataField>state</DataField>
> <rd:TypeName>System.String</rd:TypeName>
> </Field>
> <Field Name="zip">
> <DataField>zip</DataField>
> <rd:TypeName>System.String</rd:TypeName>
> </Field>
> <Field Name="contract">
> <DataField>contract</DataField>
> <rd:TypeName>System.Boolean</rd:TypeName>
> </Field>
> </Fields>
> <Query>
> <DataSourceName>pubs</DataSourceName>
> <CommandText>select * from authors</CommandText>
> <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
> </Query>
> </DataSet>
> </DataSets>
> <LeftMargin>1in</LeftMargin>
> <rd:SnapToGrid>true</rd:SnapToGrid>
> <rd:DrawGrid>true</rd:DrawGrid>
> <rd:ReportID>7a57b47c-d471-411b-abea-bc7acc3f1a16</rd:ReportID>
> <BottomMargin>1in</BottomMargin>
> <Language>en-US</Language>
> </Report>
> --
> Ravi Mumulla (Microsoft)
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Nytr0x" <nytr0x@.yahoo.com> wrote in message
> news:%23iNlXG0aEHA.3792@.TK2MSFTNGP09.phx.gbl...
> > Hi I've been puzzling over this one for ages, Imagine a dataset like:
> >
> > ShiftStartDate, ShiftEndDate, NameID, Name, AbsenceCode
> > 1-Jan 07:00 1-Jan 15:00 00001 Fred S
> > 2-Jan 07:00 2-Jan 15:00 00001 Fred S
> > 3-Jan 07:00 3-Jan 15:00 00001 Fred
> > 4-Jan 07:00 4-Jan 15:00 00001 Fred S
> > 5-Jan 07:00 5-Jan 15:00 00001 Fred S
> > 6-Jan 07:00 6-Jan 15:00 00001 Fred
> > 1-Jan 07:00 1-Jan 15:00 00002 Jane
> > 2-Jan 07:00 2-Jan 15:00 00002 Jane S
> > 3-Jan 07:00 3-Jan 15:00 00002 Jane S
> > 4-Jan 07:00 4-Jan 15:00 00002 Jane S
> > 5-Jan 07:00 5-Jan 15:00 00002 Jane S
> > 6-Jan 07:00 6-Jan 15:00 00002 Jane
> >
> > I would like to group by consecutive absence codes to generate a report
> > like:
> >
> > Fred had 2 occurrences of AbsenceCode S
> > 1-Jan 07:00 to 2-Jan 15:00
> > 4-Jan 07:00 to 5-Jan 15:00
> > Jane had 1 occurrence of AbsenceCode S
> > 2-Jan 07:00 to 5-Jan 15:00
> >
> > I have many more codes, and many more records, How can I group by each
> > occurrence like this?
> > I've tried using RunningValue with Previous(AbsenceCode) but RS won't
> allow
> > nested aggregate functions.
> >
> > Thanks in advance,
> > N.
> >
> >
>|||Yes, ths will first group by name and then by absense code. If you want to
do one group per absense code for each name, you'd have to do that in SQL.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Nytr0x" <nytr0x@.yahoo.com> wrote in message
news:OCioZO9aEHA.3692@.TK2MSFTNGP09.phx.gbl...
> I haven't had chance to test your example yet. But wouldn't this just
group
> each AbsenceCode for each Name? In the example given I want two groups
for
> the AbsenceCode S for Fred and 1 group for Jane.
> Thanks,
> N
> "Ravi Mumulla (Microsoft)" <ravimu@.online.microsoft.com> wrote in message
> news:%23VsZSq0aEHA.2544@.TK2MSFTNGP10.phx.gbl...
> > Create two groups - one on Name and another one on AbsenceCode. See the
> > attached example that goes against local pubs database.
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <Report
> >
>
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefini
> > tion"
> >
>
xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
> > <RightMargin>1in</RightMargin>
> > <Body>
> > <ReportItems>
> > <Table Name="table1">
> > <Height>1in</Height>
> > <Style />
> > <Header>
> > <TableRows>
> > <TableRow>
> > <Height>0.25in</Height>
> > <TableCells>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox4">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <TextDecoration>Underline</TextDecoration>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > <FontWeight>700</FontWeight>
> > </Style>
> > <ZIndex>15</ZIndex>
> > <rd:DefaultName>textbox4</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value>state</Value>
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox3">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <TextDecoration>Underline</TextDecoration>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > <FontWeight>700</FontWeight>
> > </Style>
> > <ZIndex>14</ZIndex>
> > <rd:DefaultName>textbox3</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value>city</Value>
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox1">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <TextDecoration>Underline</TextDecoration>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > <FontWeight>700</FontWeight>
> > </Style>
> > <ZIndex>13</ZIndex>
> > <rd:DefaultName>textbox1</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value>Name</Value>
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox2">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <TextDecoration>Underline</TextDecoration>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > <FontWeight>700</FontWeight>
> > </Style>
> > <ZIndex>12</ZIndex>
> > <rd:DefaultName>textbox2</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value>address</Value>
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > </TableCells>
> > </TableRow>
> > </TableRows>
> > </Header>
> > <Details>
> > <TableRows>
> > <TableRow>
> > <Height>0.25in</Height>
> > <TableCells>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="state">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <ZIndex>3</ZIndex>
> > <rd:DefaultName>state</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value />
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="city">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <ZIndex>2</ZIndex>
> > <rd:DefaultName>city</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value />
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="au_fname">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <ZIndex>1</ZIndex>
> > <rd:DefaultName>au_fname</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value>=Fields!au_fname.Value & " " &
> > Fields!au_lname.Value</Value>
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="address">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <rd:DefaultName>address</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value>=Fields!address.Value</Value>
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > </TableCells>
> > </TableRow>
> > </TableRows>
> > </Details>
> > <DataSetName>pubs</DataSetName>
> > <Width>5.375in</Width>
> > <TableGroups>
> > <TableGroup>
> > <Header>
> > <TableRows>
> > <TableRow>
> > <Height>0.25in</Height>
> > <TableCells>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox12">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <ZIndex>11</ZIndex>
> > <rd:DefaultName>textbox12</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value>=Fields!state.Value & " [" &
> > RunningValue(Fields!state.Value, Count, "table1_Group1") & "
> > authors]"</Value>
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox11">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <ZIndex>10</ZIndex>
> > <rd:DefaultName>textbox11</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value />
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox5">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <ZIndex>9</ZIndex>
> > <rd:DefaultName>textbox5</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value />
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox6">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <ZIndex>8</ZIndex>
> > <rd:DefaultName>textbox6</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value />
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > </TableCells>
> > </TableRow>
> > </TableRows>
> > </Header>
> > <Grouping Name="table1_Group1">
> > <GroupExpressions>
> > <GroupExpression>=Fields!state.Value</GroupExpression>
> > </GroupExpressions>
> > </Grouping>
> > </TableGroup>
> > <TableGroup>
> > <Header>
> > <TableRows>
> > <TableRow>
> > <Height>0.25in</Height>
> > <TableCells>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox13">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <ZIndex>7</ZIndex>
> > <rd:DefaultName>textbox13</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value />
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox14">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <ZIndex>6</ZIndex>
> > <rd:DefaultName>textbox14</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value>=Fields!city.Value & " [" &
> > RunningValue(Fields!city.Value, Count, "table1_Group2") & "
> > authors]"</Value>
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox15">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <ZIndex>5</ZIndex>
> > <rd:DefaultName>textbox15</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value />
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > <TableCell>
> > <ReportItems>
> > <Textbox Name="textbox16">
> > <Style>
> > <PaddingLeft>2pt</PaddingLeft>
> > <FontSize>8pt</FontSize>
> > <PaddingBottom>2pt</PaddingBottom>
> > <PaddingTop>2pt</PaddingTop>
> > <PaddingRight>2pt</PaddingRight>
> > </Style>
> > <ZIndex>4</ZIndex>
> > <rd:DefaultName>textbox16</rd:DefaultName>
> > <CanGrow>true</CanGrow>
> > <Value />
> > </Textbox>
> > </ReportItems>
> > </TableCell>
> > </TableCells>
> > </TableRow>
> > </TableRows>
> > </Header>
> > <Grouping Name="table1_Group2">
> > <GroupExpressions>
> > <GroupExpression>=Fields!city.Value</GroupExpression>
> > </GroupExpressions>
> > <Parent>=Fields!state.Value</Parent>
> > </Grouping>
> > </TableGroup>
> > </TableGroups>
> > <TableColumns>
> > <TableColumn>
> > <Width>1.625in</Width>
> > </TableColumn>
> > <TableColumn>
> > <Width>1.375in</Width>
> > </TableColumn>
> > <TableColumn>
> > <Width>1.25in</Width>
> > </TableColumn>
> > <TableColumn>
> > <Width>1.125in</Width>
> > </TableColumn>
> > </TableColumns>
> > </Table>
> > </ReportItems>
> > <Style />
> > <Height>4.75in</Height>
> > </Body>
> > <TopMargin>1in</TopMargin>
> > <DataSources>
> > <DataSource Name="pubs">
> >
> > <rd:DataSourceID>d743d813-756c-4688-850b-f2e6deda54b0</rd:DataSourceID>
> > <ConnectionProperties>
> > <DataProvider>SQL</DataProvider>
> > <ConnectString>initial catalog=pubs</ConnectString>
> > <IntegratedSecurity>true</IntegratedSecurity>
> > </ConnectionProperties>
> > </DataSource>
> > </DataSources>
> > <Width>7.125in</Width>
> > <DataSets>
> > <DataSet Name="pubs">
> > <Fields>
> > <Field Name="au_id">
> > <DataField>au_id</DataField>
> > <rd:TypeName>System.String</rd:TypeName>
> > </Field>
> > <Field Name="au_lname">
> > <DataField>au_lname</DataField>
> > <rd:TypeName>System.String</rd:TypeName>
> > </Field>
> > <Field Name="au_fname">
> > <DataField>au_fname</DataField>
> > <rd:TypeName>System.String</rd:TypeName>
> > </Field>
> > <Field Name="phone">
> > <DataField>phone</DataField>
> > <rd:TypeName>System.String</rd:TypeName>
> > </Field>
> > <Field Name="address">
> > <DataField>address</DataField>
> > <rd:TypeName>System.String</rd:TypeName>
> > </Field>
> > <Field Name="city">
> > <DataField>city</DataField>
> > <rd:TypeName>System.String</rd:TypeName>
> > </Field>
> > <Field Name="state">
> > <DataField>state</DataField>
> > <rd:TypeName>System.String</rd:TypeName>
> > </Field>
> > <Field Name="zip">
> > <DataField>zip</DataField>
> > <rd:TypeName>System.String</rd:TypeName>
> > </Field>
> > <Field Name="contract">
> > <DataField>contract</DataField>
> > <rd:TypeName>System.Boolean</rd:TypeName>
> > </Field>
> > </Fields>
> > <Query>
> > <DataSourceName>pubs</DataSourceName>
> > <CommandText>select * from authors</CommandText>
> > <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
> > </Query>
> > </DataSet>
> > </DataSets>
> > <LeftMargin>1in</LeftMargin>
> > <rd:SnapToGrid>true</rd:SnapToGrid>
> > <rd:DrawGrid>true</rd:DrawGrid>
> > <rd:ReportID>7a57b47c-d471-411b-abea-bc7acc3f1a16</rd:ReportID>
> > <BottomMargin>1in</BottomMargin>
> > <Language>en-US</Language>
> > </Report>
> >
> > --
> > Ravi Mumulla (Microsoft)
> > SQL Server Reporting Services
> >
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > "Nytr0x" <nytr0x@.yahoo.com> wrote in message
> > news:%23iNlXG0aEHA.3792@.TK2MSFTNGP09.phx.gbl...
> > > Hi I've been puzzling over this one for ages, Imagine a dataset like:
> > >
> > > ShiftStartDate, ShiftEndDate, NameID, Name, AbsenceCode
> > > 1-Jan 07:00 1-Jan 15:00 00001 Fred S
> > > 2-Jan 07:00 2-Jan 15:00 00001 Fred S
> > > 3-Jan 07:00 3-Jan 15:00 00001 Fred
> > > 4-Jan 07:00 4-Jan 15:00 00001 Fred S
> > > 5-Jan 07:00 5-Jan 15:00 00001 Fred S
> > > 6-Jan 07:00 6-Jan 15:00 00001 Fred
> > > 1-Jan 07:00 1-Jan 15:00 00002 Jane
> > > 2-Jan 07:00 2-Jan 15:00 00002 Jane S
> > > 3-Jan 07:00 3-Jan 15:00 00002 Jane S
> > > 4-Jan 07:00 4-Jan 15:00 00002 Jane S
> > > 5-Jan 07:00 5-Jan 15:00 00002 Jane S
> > > 6-Jan 07:00 6-Jan 15:00 00002 Jane
> > >
> > > I would like to group by consecutive absence codes to generate a
report
> > > like:
> > >
> > > Fred had 2 occurrences of AbsenceCode S
> > > 1-Jan 07:00 to 2-Jan 15:00
> > > 4-Jan 07:00 to 5-Jan 15:00
> > > Jane had 1 occurrence of AbsenceCode S
> > > 2-Jan 07:00 to 5-Jan 15:00
> > >
> > > I have many more codes, and many more records, How can I group by each
> > > occurrence like this?
> > > I've tried using RunningValue with Previous(AbsenceCode) but RS won't
> > allow
> > > nested aggregate functions.
> > >
> > > Thanks in advance,
> > > N.
> > >
> > >
> >
> >
>