Parsing a dictionary to form where clause in functional select

Hi, I have a dictionary with column names and corresponding values as key/value pair. How to parse it to create where clause for functional select? For now I have columns which accept “=” as operator. Thanks,

Hi,

You could use something like the following.

{(=;x;$[-11h=type y;enlist;]y)}'[key d;value d]

This takes the keys and values from the dictionary and passes them into a function as parameters. You also need to remember that symbols that are not column names need to be enlisted. Therefore a conditional is included to check if the value is an atom. One assumption we make here is that you will never give a column name as a value.

In a functional select this would look like…

q)t:([]c1:xxx;c2:aab;c3:1 2 3)q)d:c1c2!(x;a)q)tc1 c2 c3--------x a 1x a 2x b 3q)dc1| xc2| aq)?[t;{(=;x;$[-11h=type y;enlist;]y)}‘[key d;value d];0b;()]c1 c2 c3--------x a 1x a 2q)d:c1c2c3!(x;a;1)q)?[t;{(=;x;$[-11h=type y;enlist;]y)}’[key d;value d];0b;()]c1 c2 c3--------x a 1`

Hope this works for you, let me know otherwise.

Regards,

Jordan Logan