可以在查询中使用变量,因为我的参数之前需要详细说明吗?

时间:2016-02-03 07:49:08

标签: jasper-reports

我正在处理jasper报告。我创建了一个名为setInterval的参数,我的代码将从DB中获取值以填充页面中的下拉值。

问题是,在db中,表有列别名和表名,别名值是"就业类型" (空格黑白字符串)。在jrxml中,如果提供了空格,则查询将失败(即参数值为" Employment Type")。

所以可以建议我如何解决它。我可以使用新的Employment Type,将参数值分配给此变量并在查询中使用吗?

查询

fx_variable

参数:

SELECT Slno as "Sl. No.", EmpUID , EmployeeID as "Employee ID", EmployeeName as "Employee Name", cast(DateOfJoining as date) as "Date of joining", Department , Division , SalaryEarnedDaily as "Salary-Earned(Daily)", ApprovedOTHours As "O.T Hours", OTHours, OTAmount as "OT Amount", TotalAmount as "Total ( earned salary + OT)", employment_Type 
FROM Temp_EmpSalaryDaily 
WHERE ((EmployeeID = $P{EmployeeID}) or (EmployeeName like $P{Name})) and Division in ($P!{Divisions}) and Department in ($P!{Departments})and employment_Type in ($P!{Employment Type})

0 个答案:

没有答案