How to fill the empty rows with previous value?

We have the data like this.

Sno SNumber Date
1
2 1 01/11/2017
3 2
4 3
5 4
6 5
7 1 02/11/2017
8 2
9 3
10 1 03/11/2017
11 2
12 3
13 4
14 5
15 1 04/11/2017
16 2
17 3
18 4
19 5
20 6

 

How to show the data like below?

Sno SNumber Date_Field
1
2 1 01/11/2017
3 2 01/11/2017
4 3 01/11/2017
5 4 01/11/2017
6 5 01/11/2017
7 1 02/11/2017
8 2 02/11/2017
9 3 02/11/2017
10 1 03/11/2017
11 2 03/11/2017
12 3 03/11/2017
13 4 03/11/2017
14 5 03/11/2017
15 1 04/11/2017
16 2 04/11/2017
17 3 04/11/2017
18 4 04/11/2017
19 5 04/11/2017
20 6 04/11/2017

Script:

Peek_Data:
LOAD *,if(len(trim(Date))=0, peek(Date,RecNo()-SNumber), Date) as Date_Field;
LOAD *,RecNo() as Sno INLINE [
Date,SNumber
,
01/11/2017,1
,2
,3
,4
,5
02/11/2017,1
,2
,3
03/11/2017,1
,2
,3
,4
,5
04/11/2017,1
,2
,3
,4
,5
,6
]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.