有价值功能水晶报告

时间:2014-04-22 14:13:38

标签: crystal-reports

在我的报告中,我有3个参数when, week and year。 如果我选择When=schedule,则报告应该在当前周运行,而不考虑参数窗口中给出的年和周值。 如果我选择when=Now,那么报告应该运行我们在参数窗口中给出的周值和月值。 请建议。

我试过这样但不行。

if hasvalue({?Week}) and HasValue({?Year}) and {?When} = 'Now'
Then
{?Week} = {Command.WEEK} and {?Year} = {Command.YEAR}
else
({?Week} = DatePart ("ww", Currentdatetime) and {?Year} = DatePart ("yyyy", Currentdatetime)

3 个答案:

答案 0 :(得分:1)

在水晶报告中,ISNULL和INSTR功能将在这种情况下使用。

ISNULL: - 检查值是否为null,然后返回true,否则返回false。 INSTR: - 检查字符串中的子字符串,如果找到则返回索引,否则返回0。

检查链接中的详细信息

http://publib.boulder.ibm.com/infocenter/rsahelp/v7r0m0/index.jsp?topic=/com.businessobjects.integration.eclipse.designer.doc/designer/Crystal_Syntax47.html

在你的情况下

if isnull({?Week}) and isnull({?Year}) and isnull{?When} 
 Then 
   return false
 else
    //in else again check with if else condition
   if {?When} = 'schedule'
     then
      do something
   else
      do something

答案 1 :(得分:0)

我的方法是:

而不是检查参数的null值。为参数提供默认值并检查false条件的值。

假设我们将默认值设为None

if {?Week}="None" and {?Year}="None" and {?When} = 'Now'
Then
{?Week} = {Command.WEEK} and {?Year} = {Command.YEAR}
else
({?Week} = DatePart ("ww", Currentdatetime) and {?Year} = DatePart ("yyyy", Currentdatetime)

Note: Above code is just an example change it as per your requirement.

答案 2 :(得分:0)

您可以这样使用:

if {?Week}<>"" then {Command.WEEK}={?Week} else {Command.WEEK}={Command.WEEK}

希望这会有所帮助。

相关问题