我正在使用Crystal Reports XI编写一份报告,它允许用户使用多个可选的动态参数来过滤帮助台工单。如果我为每个参数都进行选择,那么就会返回预期结果,但如果我省略任何一个参数,它就不会返回任何内容,并且当我查看SQL查询时,它会显示“没有使用SQL查询,因为记录选择公式未返回任何记录”。我目前的记录选择代码如下:
{Incident.State:} = "C" and
{Incident.Close Date & Time} in {?BDate} to {?EDate} and
If HasValue({?Group}) Then (
{Groups.Code} = {?Group}
)
and
If HasValue({?Category}) Then (
{Incident.Subject Description} = {?Category}
)
and
If HasValue({?Staff}) Then (
{Incident_Details.Login ID} = {?Staff}
)
and
If HasValue({?Community}) Then (
{Incident.Company Name} = {?Community}
)
在我看来,这似乎应该是有效的,如果我省略If语句来验证参数是否有值,那么我会得到一个错误,因此HasValue似乎正常工作。有什么想法吗?