Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

date from to iteration

Here is something I want to share.

It is a example of a date range iteration.

tmp:

load * inline

[from,to,name

'10/08/2010','10/09/2010','Jack'

'01/01/2010','01/03/2010','John'

'01/20/2010','02/03/2010','Mike'

'02/25/2010','03/11/2010','Nic'

];

range:

LOAD

    from,

    to,

    from+iterno()-1 as date_day,

    name ,

    iterno() as iter

resident tmp

while iterno() <= num(to)-num(from)+1;

date_day from name to iter
1/1/2010 01/01/2010 John 01/03/2010 1
1/2/2010 01/01/2010 John 01/03/2010 2
1/3/2010 01/01/2010 John 01/03/2010 3
1/20/2010 01/20/2010 Mike 02/03/2010 1
1/21/2010 01/20/2010 Mike 02/03/2010 2
1/22/2010 01/20/2010 Mike 02/03/2010 3
1/23/2010 01/20/2010 Mike 02/03/2010 4
1/24/2010 01/20/2010 Mike 02/03/2010 5
1/25/2010 01/20/2010 Mike 02/03/2010 6
1/26/2010 01/20/2010 Mike 02/03/2010 7
1/27/2010 01/20/2010 Mike 02/03/2010 8
1/28/2010 01/20/2010 Mike 02/03/2010 9
1/29/2010 01/20/2010 Mike 02/03/2010 10
1/30/2010 01/20/2010 Mike 02/03/2010 11
1/31/2010 01/20/2010 Mike 02/03/2010 12
2/1/2010 01/20/2010 Mike 02/03/2010 13
2/2/2010 01/20/2010 Mike 02/03/2010 14
2/3/2010 01/20/2010 Mike 02/03/2010 15
2/25/2010 02/25/2010 Nic 03/11/2010 1
2/26/2010 02/25/2010 Nic 03/11/2010 2
2/27/2010 02/25/2010 Nic 03/11/2010 3
2/28/2010 02/25/2010 Nic 03/11/2010 4
3/1/2010 02/25/2010 Nic 03/11/2010 5
3/2/2010 02/25/2010 Nic 03/11/2010 6
3/3/2010 02/25/2010 Nic 03/11/2010 7
3/4/2010 02/25/2010 Nic 03/11/2010 8
3/5/2010 02/25/2010 Nic 03/11/2010 9
3/6/2010 02/25/2010 Nic 03/11/2010 10
3/7/2010 02/25/2010 Nic 03/11/2010 11
3/8/2010 02/25/2010 Nic 03/11/2010 12
3/9/2010 02/25/2010 Nic 03/11/2010 13
3/10/2010 02/25/2010 Nic 03/11/2010 14
3/11/2010 02/25/2010 Nic 03/11/2010 15
10/8/2010 10/08/2010 Jack 10/09/2010 1
10/9/2010 10/08/2010 Jack 10/09/2010 2
1 Reply
gandalfgray
Specialist II
Specialist II

Thanks for sharing Pieter,

could be handy sometime!