

soheir
@soheir
•
Joined Feb 2024 •
Active a year ago
Forum Replies Created
-
This might be what you’re looking for then
q) x1:(`Col1;12;.z.Z) q) x2:(`Col1;12;`ERROR) q) show y:(x1;x1;x1;x2) `Col1 12 2021.12.08T17:46:26.162 `Col1 12 2021.12.08T17:46:26.162 `Col1 12 2021.12.08T17:46:26.162 `Col1 12 `ERROR q) {x,@[gtime;last x;0Np]}each y `Col1 12 2021.12.08T17:46:26.162 2021.12.08T17:46:26.162 `Col1 12 2021.12.08T17:46:26.162 2021.12.08T17:46:26.162 `Col1 12 2021.12.08T17:46:26.162 2021.12.08T17:46:26.162 `Col1 12 `ERROR 0Np
-
soheir
MemberDecember 8, 2021 at 12:00 am in reply to: Clean way to do conditional statement in SQL?Hi @ekallivrousis, try using a vector conditional – https://code.kx.com/q/ref/vector-conditional/
update c:?[b;`true;`false] from t
b = vector of booleans being passed in
-
Hey @ekallivrousis – is this what you’re trying to do?
q)x:(`Col1;12;.z.Z) q)y:(x;x;x) `Col1 12 2021.12.08T17:33:36.400 `Col1 12 2021.12.08T17:33:36.400 `Col1 12 2021.12.08T17:33:36.400 q)y,'gtime .z.P `Col1 12 2021.12.08T17:33:36.400 2021.12.08D17:33:47.617397000 `Col1 12 2021.12.08T17:33:36.400 2021.12.08D17:33:47.617397000 `Col1 12 2021.12.08T17:33:36.400 2021.12.08D17:33:47.617397000
Or are you looking to use the last item of each list of y (list of lists) as an input to gtime ?