2021.12.08 08:48 AM
I was wondering what the best way to do conditional update in q? I know i can do the below but wondering if theres a shorter/cleaner way.
t:flip `a`b!(1 2;01b)
update c:{$[x;`true;`false]} each b from t
2021.12.08 09:00 AM
update c:?[b;`true;`false] from t
2021.12.08 09:00 AM
update c:?[b;`true;`false] from t
2021.12.08 09:01 AM
exactly what i was looking for! thank you
2021.12.08 09:05 AM
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
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.