title: How to pass multiple optional parameters using Ireport
body: <p>I am trying to add optional parameters to the where clause of my query.  Each have been tested and work individually but how can I incorporate them into the query so it doesn't matter which one is filled by the user, the report will still run.</p>
  
  <p>The parameters are:  </p>
  
  <pre><code> $P!{qparam_TickerValue} , $P!{qparam_CusipValue}, $P!{qparam_DescValue};
  </code></pre>
  
  <p>This is what their Default Value Expression looks like (TickerValue):</p>
  
  <pre><code>$P{qparam_Ticker}=="" ? "" : "and p.Ticker='"+$P{qparam_Ticker}+ "'"
  </code></pre>
  
  <p>This is the query block I am trying to complete.</p>
  
  <pre><code>    where f.ParentID=$P{qparam_PlanParent}
      and cpp.PeriodBeginDate&gt;=$P{qparam_BeginDateString}
      and cpp.PeriodEndDate&lt;=$P{qparam_EndDateString}
      $P!{qparam_CusipValue}
      $P!{qparam_TickerValue} ;
  </code></pre>
  
  <p>SOLVED!</p>
  
  <p>With help from a Java expert, we came up with this.</p>
  
  <pre><code>(($P{qparam_Ticker}==null) || $P{qparam_Ticker}.isEmpty())
  ? (
  (($P{qparam_Cusip}==null) || $P{qparam_Cusip}.isEmpty())
  ? (
  (($P{qparam_Desc}==null) || $P{qparam_Desc}.isEmpty())
  ? ""
  : " and p.Description='" + $P{qparam_Desc} + "'"
  )
  : " and cpp.SecurityId='" + $P{qparam_Cusip} + "'"
  )
  : " and p.Ticker='" + $P{qparam_Ticker} + "'"
  </code></pre>
  
  <p>Checks to see what conditions are being filled and then assigns the appropriate statement to the query block.</p>