Add a boolean for each symbol in List

I am trying to add a column in a select statement that checks if the symbol is in a list.  I am getting a length error and I know its something quick, just cant find the syntax.

So I have a select statement like

select time, sym, shares, price:price*2, contains:sym in symlist from table

but it gives me a length error I think because in contains:sym in symlist the sym is a list of syms for the whole table.  Which seems strange because in price:price*2 works as expected.

select time, sym, shares, price:price*2, contains:sym in: symlist from table

Perfect, thanks Akash,  What about inside select statements?

getmax:{[s]select max price from trade where sym=s};select time, sym, shares, price:price*2, max:getmax[sym] from table

I dont think I can use that same :

looking at the code, do you want below:-

select time, sym, shares, price:price*2, myMax:(max;price) fby sym from table

Maybe another approach like lj is more ideal for your problem?

(select time,sym,shares,price*2 from table)lj select maximum:max price by sym from trade

This will avoid scanning the trade table n rows times which is more efficient imo.

If you still insist on using the function, then you can do:

getmax:{[s]select max price from trade where sym=s};select time, sym, shares, price:price*2, max:getmax'[sym] from table

*I wouldn’t recommend using keywords(i.e. max) as column names because this will cause issues

Thanks WooiKent, that helps