Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Date in Blocks

Hi

I have a list of absences that I want to report on.  Rather than show each date I want to show the date in blocks.  Please see my data below:

Joe 01/04/14

Joe 02/04/14

Joe 03/04/14

Joe 15/07/14

Joe 16/07/14

Joe 12/08/14

Bill 01/07/14

Bill 02/07/14

Bill 20/11/14

Bill 21/11/14

Bill 15/12/15

I want to output :

Joe 01/04/14 - 03/04/14

Joe 15/07/14 - 16/07/14

Joe 12/08/14 - 12/08/14

Bill 01/07/14 - 02/07/14

Bill 20/11/14 - 21/11/14

Bill 15/12/14 - 15/12/14

Any thoughts?

Thanks

Phil

13 Replies
anbu1984
Master III
Master III

Load*,If(Employee<>Peek(Employee),AutoNumber(Employee&Date),If(Date=Peek(Date)+1,Peek(Grp),

AutoNumber(Employee&Date)))As Grp  Resident T1 Order By Employee,Date;


If(Employee<>Peek(Employee),AutoNumber(Employee&Date) If you encounter employee first time, then generate autonumber using combination of Employee&Date


If(Date=Peek(Date)+1,Peek(Grp) Else If Employee is already present, then check if previous date + one day is equal to current row date, if yes then use autonumber generated in previous row to indicate it belongs to same group


Else generate new Autonumber using AutoNumber(Employee&Date)

ankitaag
Partner - Creator III
Partner - Creator III

But do you think it's creating the same group?

ex-

Joe,01/04/14

Joe,02/04/14

it is creating 1 for the 1st and 2 for the 2nd.


Shouldn't they belong to the same group?

anbu1984
Master III
Master III

If data is properly ordered, then you will get one for both these rows.

You can run the above script for Tables T1 and T2 and check group values

ankitaag
Partner - Creator III
Partner - Creator III

That's what I did..

I wrote exit script; before Final table and checked that I m getting different group nos for all