How to apply function that returns table to a list? (Q+KDB)

637 views Asked by At

I have a function {[x]} that returns a table of time series values. I would like to apply this to different keys `a`b`c but am unable to do so using {[x]}/`a`b`c

I'd like the result to be one table with the contents of each individual query. How can I go about doing this? FWIW, I have to do this in Q - can't install q for python etc.

1

There are 1 answers

4
Alexander Belopolsky On BEST ANSWER

Let your function be

q)f:{([]t:00:01 00:02;x)}
q)f `a
t     x
-------
00:01 a
00:02 a

You can apply it to a list and flatten the result as folows

q)raze f each `a`b
t     x
-------
00:01 a
00:02 a
00:01 b
00:02 b