How to pass dictionary into query constraint?
<p>If this is the dictionary of constraint:</p>

<pre><code>dictName:`region`Code;
dictValue:(`NJ`NY;`EEE213);
dict:dictName!dictValue;
</code></pre>

<p>I would like to pass the dict to a function and depending on how many keys there are and let the query react accordingly. If there is one key region, then I would like to put it as</p>

<pre><code>select from table where region in dict`region;
</code></pre>

<p>The same thing is for code. But if I pass two keys, I would like the query knows and pass it as:</p>

<pre><code>select form table where region in dict`region,Code in dict`code;
</code></pre>

<p>Is there any way to do this?</p>

<p>I came up this code:</p>

<pre><code> funcForOne:{[constraint]?[`bce;enlist(in;constraint;(`dict;enlist constraint));0b;()]};

funcForAll[]
{[dict]$[(null dict)~1;select from bce;($[(count key dict)=1;($[`region in (key dict);funcForOne[`region];funcForOne[`Code]]);select from bce where region  in dict`region,rxmCode in dict`Code])]};
</code></pre>

<p>It works for one and two constraint. but when I called <code>funcForAll[]</code> it gives type error. How should I change it? i think it is from null dict~1
I tried count too. but doesn't work too well.</p>

<h2>Update</h2>

<p>So I did this but I have some error  </p>

<pre><code>    tab:([]code:`B90056`B90057`B90058`B90059;region:`CA`NY`NJ`CA);                                                                                             
dictKey:`region`Code;dictValue:(`NJ`NY;`B90057);
dict:dictKey!dictValue;
?[tab;f dict;0b;()]; 
</code></pre>

<p>and I got 'NY error. Do you know why? Also,if I pass a null dictionary it doesn't seem working.</p>