so I have a table
date, sym, val
where unfortunately, the 3rd entry sometimes is null. In that case, I want the previous value filling it up.
I understood I could use “fills”. But I wonder why below doesn;t work?
table: update val: prev val by sym from table where null val;
Hi,
Think you will need to have:
update val:(fills;val) fby sym from t
the “where null val” part of your statement will return the number of rows that you have nulls in your val col, and then you set val:prev val which is not there therefore when you update there’s no change.
Marcus
Sent from Mailbox
On Wed, Nov 4, 2015 at 1:44 PM, ZCodeNoob <jieyunfu@gmail.com> wrote:
so I have a table
date, sym, val
where unfortunately, the 3rd entry sometimes is null. In that case, I want the previous value filling it up.
I understood I could use “fills”. But I wonder why below doesn;t work?
table: update val: prev val by sym from table where null val;
–
Submitted via Google Groups
t1:(sym:10#a
b;p1:til 10);
t1:update p1:0Nj from t where i in 2 3 6 7;
t2:update p2:fills p1 by sym from t1;
t3:update p2:(fills;p1) fby sym from t1;
t2~t3 / true
q)t2
sym p1 p2
---------
a 0 0
b 1 1
a 0
b 1
a 4 4
b 5 5
a 4
b 5
a 8 8
b 9 9