2021.12.08 09:28 AM
x:(`Col1;12;.z.Z)
y:(x;x;x)
//add gtime of last element to end of x
x,@[gtime;last x;0Np]
//How do i do this for y?
So i think i did x correctly unless theres a better way. But how would i handle y? I want to append to end of each list in y.
2021.12.08 09:50 AM
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
2021.12.08 09:36 AM - edited 2021.12.08 09:37 AM
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 ?
2021.12.08 09:38 AM
Close, i want it to be in protected eval @[], also i dont want to convert current .z.P i want to convert the last col of each list in y. I bold the column below that i want to use
`Col1 12 2021.12.08T17:33:36.400
`Col1 12 2021.12.08T17:33:36.400
`Col1 12 2021.12.08T17:33:36.400
2021.12.08 09:50 AM
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
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.