title: How can we filter a query that depends on a parameter that the user chooses?
body: <p>I'm trying to filter my query depends on what the user selected in period (month or year)
  I retrieve the parameter through BIRT. </p>
  
  <p>My query is :</p>
  
  <pre><code>SELECT DATE
  FROM TABLE
  WHERE Year(DATE) = Year(CURRENT_TIMESTAMP) AND Month(DATE) = Month(CURRENT_TIMESTAMP)
  </code></pre>
  
  <p>My result is :</p>
  
  <pre><code>DATE
  2017-02-14
  2017-02-14
  2017-02-14
  2017-02-14
  2017-02-14
  2017-02-14
  2017-02-14
  2017-02-01
  2017-02-02
  </code></pre>
  
  <p>What I'm trying to do is : if the user select year, i put the last condition in comment, the result should be :</p>
  
  <pre><code>DATE
  2017-02-14
  2017-02-14
  2017-02-14
  2017-02-14
  2017-02-14
  2017-02-14
  2017-02-14
  2017-01-25
  2017-01-26
  2017-02-01
  2017-02-02
  2017-01-20
  2017-01-20
  2017-01-20
  2017-01-20
  2017-01-20
  2017-01-20
  2017-01-20
  2017-01-20
  2017-01-20
  </code></pre>
  
  <p>I tried with the CASE like : </p>
  
  <pre><code>CASE WHEN USER_PARAM = 'month' then Month(DATE) = Month(CURRENT_TIMESTAMP) END
  </code></pre>
  
  <p>Obviously, this is not good,
  I tried with OR/AND like : </p>
  
  <pre><code>Year(DATE) = Year(CURRENT_TIMESTAMP) 
      OR ('USER_PARAM' = 'MONTH' AND Month(DATE) = Month(CURRENT_TIMESTAMP))
  </code></pre>
  
  <p>If <code>'USER_PARAM' = 'MONTH'</code> is true -> This is not working because I have all the years (not the current one)</p>
  
  <pre><code>Year(DATE) = Year(CURRENT_TIMESTAMP) 
      AND ('USER_PARAM' = 'MONTH' AND Month(DATE) = Month(CURRENT_TIMESTAMP))
  </code></pre>
  
  <p>If <code>'USER_PARAM' = 'MONTH'</code> is false-> This is not working because I don't have any data</p>