hi everyone, i tried to obtain previous value for null values and wrote the script as shown in screenshot, but the result i got was not correct, can any please give the solution for this
Logic suggested by trdandamudi must work.
LOAD * INLINE [
Date1, Properties, Value1
11/12/12, A/c, 40
13/12/12, A/c, 50
14/12/12, Fridge, 100
17/12/12, Fridge, 250
15/12/12, TV, 350
Load Date1 as Date,
Properties as Property,
if(len(trim(Value1))=0,Peek('Value'),Value1) as Value
DROP Table Data;
In the screen shot, you are probably taking Value1 instead of Value in the table box. I.e. you would see the right values in Value field. Also note, in table box you would not see all the values. You should look at the table view (Ctrl+T) instead to check if it is working fine.
You are welcome...
Might be you don't have nulls and you have only blanks and that is the reason you are not getting the output. Nulls are different from blanks. Give a try on the below and let me know:
If(IsNull(Value) OR Value='',Peek('Value'),Value1) as Value