Crystal reports 运行total公式的Crystal报表不起作用

Crystal reports 运行total公式的Crystal报表不起作用,crystal-reports,cumulative-sum,Crystal Reports,Cumulative Sum,上面的公式总是返回零,我知道@num_qty中有值,在某些行中它有NULL,如果我试图使用下面的代码计算NULL,它也会给我一个错误 WhileReadingRecords; numbervar Samples; if {product.sku}="card-sample" then Samples = Samples + {@num_qty}; Samples; 有什么想法吗??? 注意:我这样做是因为,在我的情况下,我不能使用CR内置的运行总计我相信您的示例变量赋值是错误的

上面的公式总是返回零,我知道@num_qty中有值,在某些行中它有NULL,如果我试图使用下面的代码计算NULL,它也会给我一个错误

WhileReadingRecords;
numbervar Samples;
if {product.sku}="card-sample" then
    Samples = Samples + {@num_qty};

Samples;   
有什么想法吗???
注意:我这样做是因为,在我的情况下,我不能使用CR内置的运行总计

我相信您的
示例
变量赋值是错误的,您需要使用
:=
而不是
=
,如下所示:

if (not (isnull{@num_qty})) then    
WhileReadingRecords;
numbervar Samples;
if {product.sku}="card-sample" then
    Samples := Samples + {@num_qty};

Samples;