Tuesday, 15 July 2014

mysql - How to pass multiple optional parameters using Ireport -



mysql - How to pass multiple optional parameters using Ireport -

i trying add together optional parameters clause of query. each have been tested , work individually how can incorporate them query doesn't matter 1 filled user, study still run.

the parameters are:

$p!{qparam_tickervalue} , $p!{qparam_cusipvalue}, $p!{qparam_descvalue};

this default value look looks (tickervalue):

$p{qparam_ticker}=="" ? "" : "and p.ticker='"+$p{qparam_ticker}+ "'"

this query block trying complete.

f.parentid=$p{qparam_planparent} , cpp.periodbegindate>=$p{qparam_begindatestring} , cpp.periodenddate<=$p{qparam_enddatestring} $p!{qparam_cusipvalue} $p!{qparam_tickervalue} ;

solved!

with help java expert, came this.

(($p{qparam_ticker}==null) || $p{qparam_ticker}.isempty()) ? ( (($p{qparam_cusip}==null) || $p{qparam_cusip}.isempty()) ? ( (($p{qparam_desc}==null) || $p{qparam_desc}.isempty()) ? "" : " , p.description='" + $p{qparam_desc} + "'" ) : " , cpp.securityid='" + $p{qparam_cusip} + "'" ) : " , p.ticker='" + $p{qparam_ticker} + "'"

checks see conditions beingness filled , assigns appropriate statement query block.

mysql parameters ireport optional

No comments:

Post a Comment