title: KDB Apply where phrase only if column exists
body: <p>I'm looking for a way to write functional select in KDB such that the where phrases is only apply if the column exists (on order to avoid error). If the column doesn't exist, it defaults to true. </p>
  
  <p>I tried this but it didn't work</p>
  
  <pre><code>enlist(|;enlist(in;`colname;key flip table);enlist(in;`colname;filteredValues[`colname]));
  </code></pre>
  
  <p>I tried to write a simple boolean expression and use parse to get my functional form</p>
  
  <pre><code>(table[`colname] in values)|(not `colname in key flip table)
  </code></pre>
  
  <p>But kdb doesn't have short circuit so the left-hand expression is still evaluated despite the right-hand expression evaluating to true. This caused a weird output <code>boolean$()</code> which is a list of booleans all evaluating to false <code>0b</code></p>
  
  <p>Any help is appreciated. Thanks!</p>
  
  <p>EDIT 1: I have to join a series of condition with parameter specified in the dictionary <code>filters</code></p>
  
  <pre><code>cond,:(,/) {[l;k] enlist(in;k;enlist l[k])}[filters]'[a:(key filters)]
  </code></pre>
  
  <p>Then I pass this <code>cond</code> on and it gets executed on a few different selects on different tables. How can I make sure that whatever conditional expression I put in place of <code>enlist(in;k;enlist l[k]</code> will only get evaluated as the select statement gets executed.</p>