如何将Crystal Reports中的whileprintingrecords转换为SQL [英] How does whileprintingrecords in Crystal Reports translate to SQL
问题描述
我在水晶报表中寻找Group1total的值。我的背景更侧重于SQL,我试图确定以下逻辑:
I'm looking for the value of Group1total in a Crystal Report. My background is more centered around SQL and I'm trying to determine the logic behind the following:
//{@Group1total}
whileprintingrecords;
numbervar group1cost
//{@Group1cost}
whileprintingrecords;
numbervar group1cost := group1cost + {@group2total}
//{@Group2total}
whileprintingrecords;
numbervar group2cost
//{@Group2cost}
whileprintingrecords;
numbervar group2cost := group2cost + {@group3total}
//{@Group3total}
whileprintingrecords;
numbervar group3cost
//{@Group3cost}
whileprintingrecords;
numbervar group3cost := group3cost + {@group4total}
//{@Group4total}
whileprintingrecords;
numbervar group4cost
//{@Group4cost}
whileprintingrecords;
numbervar group4cost := group4cost + {XVR_projectcostbudget.cost_budget}
我注意到在SQL中执行XVR_projectcostbudget.cost_budget的SUM不会产生与Crystal Report相同的结果。任何想法?
I'm noticing that simply doing the SUM of XVR_projectcostbudget.cost_budget in SQL is not yielding the same result as the Crystal Report. Any ideas?
谢谢!
推荐答案
WhilePrintingRecords到SQL。它只影响给定公式的计算 - 基本上将其分配给报表的其中一个'pass'。请参阅 Crystal Reports 9+ - 评估次数和多次传递报告模型。
WhilePrintingRecords does NOT get translated to SQL. It only affect a given formula's calculation--essentially assigning it to one of the report's 'passes'. See Crystal Reports 9+ - Evaluation times and the multi-pass reporting model.
建议:
- 在所有四个组的页脚中的公式或数据库字段中插入摘要;这将创建您可以在公式字段中使用的字段(您可以手动创建,但这更容易)
- 创建公式字段,根据需要计算组摘要
这篇关于如何将Crystal Reports中的whileprintingrecords转换为SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!