vkennedy
@vkennedy
•
Joined Feb 2024 •
Active 6 months ago
Forum Replies Created
-
Hi,
For
wj
, the prevailing quote on entry to the window is considered valid as quotes are a step function.See this link for more details.
Window join | Reference | kdb+ and q documentation – Kdb+ and q documentation (kx.com)
-
Hi,
You can define a dictionary with the default values that you would like to assign and then use the fill operator to assign these values when the key is missing or the value is null.
q)ddef:enlist[`d]!enlist 99
q)d:`a`b`c!("";2;3)
q)(ddef^d)`d 99 -
vkennedy
MemberJanuary 4, 2022 at 12:00 am in reply to: Accessing previous calculated value from a column in current rowHello,To modify the table in place, pass it by name (i.e. `t).q)t:([]c1: 1 2 3 4 5 6 7 8 9)
q)update c2:((prev(c1)+10) + c1)%2 from `t `t
q)update c2:((prev(c2)+10) + c1)%2 from `t `t
q)t c1 c2 -------- 1 2 3 9.75 4 10.75 5 11.75 6 12.75 7 13.75 8 14.75 9 15.75 -
vkennedy
MemberJanuary 4, 2022 at 12:00 am in reply to: Accessing previous calculated value from a column in current rowHi,
Is this the result you are looking for?
q)select c2:(0^(prev(c2)+10) + c1)%2 from update c2:((0^prev(c1)+10) + c1)%2 from t c2 ----- 0 6.25 9.75 10.75 11.75 12.75 13.75 14.75 15.75
In this case, you need to explicitly fill in the zero as the result of prev on the first item of a list is null.
-
vkennedy
MemberDecember 8, 2021 at 12:00 am in reply to: Clean way to do conditional statement in SQL?update c:?[b;`true;`false] from t