Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a requirement where I need to get the most recent data if the date is null. I have to achieve this in script. Please find below the sample data
Key Date
001 24/04/2015
002 25/04/2015
- -
003 26/04/2015
004 25/04/2015
- -
- -
- -
005 29/04/2015
Expected:
Key Date
001 24/04/2015
002 25/04/2015
002 26/04/2015
003 26/04/2015
004 25/04/2015
004 26/04/2015
004 27/04/2015
004 28.04/2015
005 29/04/2015
May be like this?
Table:
LOAD id,
Key as TempKey,
Date as TempDate;
LOAD * Inline [
id, Key, Date
1, 001, 24/04/2015
2, 002, 25/04/2015
3, ,
4, 003, 26/04/2015
5, 004, 25/04/2015
6, ,
7, ,
8, ,
9, 005, 29/04/2015
];
FinalTable:
LOAD id,
If(Len(Trim(TempKey)) = 0, Peek('Key'), TempKey) as Key,
Date(If(Len(Trim(TempDate)) = 0, Peek('Date') + 1, TempDate)) as Date
Resident Table
Order By id;
DROP Table Table;
How You are getting the Blank values for both Key and date? Your Key values should not be blank.