Search code examples
kdbq-lang

checking in list from kdb instance


I am storing strings in a list under variable name res. Next, I construct a query that will look into the list of strings. However it seems like the variable is not being read.

This is what I mean:

q) hdl: (to a port)
q) res: `string1`string2`string3
**q) ans: hdl"select count i by date,sym from trade where date=xxx, sym in `res"**

When I execute the command, I always get an empty result set. I know that the resultset cannot be empty. So how can I fix my query (in bold) to return results?

Please note I am performing the task from a q session in unix box.


Solution

  • Something like the following will work:

    ans:hdl({select count i by date,sym from trade where date=xxx, sym in x};res)
    

    @mollmerx is correct about having res defined locally and not on the remote process, although my query above is preferable to a functional select.