Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I'm trying to create a new flag by looking at the previous record it has.
Can someon please help?
Any help is highly appreciated.
Please see the attachemnt
Time | Flag | Req. output |
1 | null | null |
2 | y | y |
3 | null | y |
4 | null | y |
5 | null | y |
6 | N | N |
7 | null | N |
May be this
Table_Temp:
LOAD * Inline
[
Time, Flag, Req. output
1, null, null
2, y, y
3, null, y
4, null, y
5, null, y
6, N, N
7, null, N
];
Table_Final:
LOAD *,
If(Len(Trim(Previous(Flag))) > 0 and Flag = 'null', Peek('Req Flag'), Flag) as [Req Flag]
Resident Table_Temp
Order By Time;
DROP Table Table_Temp;
Any inputs brother?
May be this
Table_Temp:
LOAD * Inline
[
Time, Flag, Req. output
1, null, null
2, y, y
3, null, y
4, null, y
5, null, y
6, N, N
7, null, N
];
Table_Final:
LOAD *,
If(Len(Trim(Previous(Flag))) > 0 and Flag = 'null', Peek('Req Flag'), Flag) as [Req Flag]
Resident Table_Temp
Order By Time;
DROP Table Table_Temp;
Thank you Brother!!
So, when we say, Flag='Null', then use peek, it keep sskipping till the filed is not 'null' and it finds any other value ??
Please correct if i'm wrong.
Yes...