optional parameter in subreport
<p>HI, all,</p><p>Thanks in advance!</p><p>The report is edited from woprint report which is the out of box one, now two optional parameters are added for actualLaborDataset, its open function is coped below. the problem is when the date parameters are set, no related data is retrieved. Any help would be appreciated!</p><p> </p><p>[font="'courier new';"]actualLaborDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), this.getName());[/font]</p><p>[font="'courier new';"]actualLaborDataSet.open();[/font]</p><p> </p><p>[font="'courier new';"]var sqlText = new String();[/font]</p><p> </p><p>[font="'courier new';"]// Add query to sqlText variable.[/font]</p><p>[font="'courier new';"]sqlText = "select workorder.taskid, labtrans.craft, labtrans.skilllevel, labtrans.laborcode, labtrans.vendor, "[/font]</p><p>[font="'courier new';"]+ "labtrans.contractnum, labtrans.regularhrs, labtrans.premiumpayhours, labtrans.payrate, "[/font]</p><p>[font="'courier new';"]+ "labtrans.premiumpayratetype, labtrans.linecost, labtrans.premiumpayrate, "[/font]</p><p>[font="'courier new';"]+ "labtrans.enterdate, labtrans.gldebitacct "[/font]</p><p>[font="'courier new';"]+ "from labtrans, workorder "[/font]</p><p>[font="'courier new';"]+ "where workorder.wonum = labtrans.refwo "[/font]</p><p>[font="'courier new';"]+ "and workorder.siteid = labtrans.siteid "[/font]</p><p>[font="'courier new';"]+ "and labtrans.genapprservreceipt = 1 "[/font]</p><p>[font="'courier new';"]+ "and workorder.siteid = '" + rows[0]["siteid"] + "'"[/font]</p><p>[font="'courier new';"]+ "and ((workorder.parent = '" + rows[0]["wonum"].replace(/'/g,"''") + "' and workorder.taskid is not null) "[/font]</p><p>[font="'courier new';"]+ "or (workorder.wonum = '" + rows[0]["wonum"].replace(/'/g,"''") + "' and workorder.taskid is null)) "[/font]</p><p>[font="'courier new';"]+ "order by workorder.taskid"[/font]</p><p>[font="'courier new';"];[/font]</p><p> </p><p>[font="'courier new';"]// **************************************************************************[/font]</p><p>[font="'courier new';"]if (params["StartDate"].value != "" && params["StartDate"].value != null)[/font]</p><p>[font="'courier new';"] {[/font]</p><p>[font="'courier new';"] sqlText = sqlText + " and labtrans.enterdate >= to_date('" + params["StartDate"] + "', 'MM/DD/YYYY')" ;[/font]</p><p>[font="'courier new';"]}[/font]</p><p>[font="'courier new';"]if (params["FinishDate"].value != "" && params["FinishDate"].value != null)[/font]</p><p>[font="'courier new';"] {[/font]</p><p>[font="'courier new';"] sqlText = sqlText + " and labtrans.enterdate <= to_date('" + params["FinishDate"] + "', 'MM/DD/YYYY')" ;[/font]</p><p>[font="'courier new';"] }[/font]</p><p> </p><p>[font="'courier new';"]// **************************************************************************[/font]</p><p> </p><p>[font="'courier new';"]actualLaborDataSet.setQuery(sqlText);[/font]</p><p> </p><p> </p>