Crystal Reports中的whileprinting记录如何转换为SQL
我在Crystal Report中查找Group1total的值。我的背景更是围绕SQL,我想确定身后以下的逻辑:Crystal Reports中的whileprinting记录如何转换为SQL
//{@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}
我注意到,仅仅做XVR_projectcostbudget.cost_budget的SQL和不产生相同的结果作为水晶报告。有任何想法吗?
谢谢!
WhilePrintingRecords不会被转换为SQL。它只影响给定公式的计算 - 基本上将其分配给报告的“通行证”之一。见Crystal Reports 9+ - Evaluation times and the multi-pass reporting model。
在你的情况,我建议:
- 插入您的群体页脚的所有四个对一个公式或数据库字段摘要;这将创建一个可以在一个公式字段使用的字段(您可以手动创建它们,但是这是比较容易)
- 创建吻合组汇总根据需要
像贾斯汀我能感觉到一个公式字段他对水晶报告感到沮丧,并将其放在这里以帮助其他人。
正试图在不同的组级别和报表的结尾用常规总和(decode(sql结构。在crystal试图用运行total field和评估公式来模拟这个),评估栏是一个代码(所有值都是数字,但表格列被声明为字符串类型:)如果字段类型是数字,则评估公式只提供“总和”功能,因此创建一个公式字段以将该列作为数字生成。在运行总量与IFF(,1,0),但不会产生结果!(即空白)
切换到Whileprintingrecords结构和工作。 这是如何工作的简洁把下面的文章中。 http://crystalreportsblog.com/crystal-reports-running-totals/#comments
显然把这个calc放到主要的sql查询中会很直接,但是使用gui表链接设置的旧报告。
Doh!不能在分页符中工作。 –
回到原来的想法,但使用基本的语法和作为公式计算为一个数字和总和在那做工作。 –
那8个单独的公式?报告的哪一部分是?仅仅解释你想要计算的东西可能会更容易一些......事情告诉我,它比需要的复杂得多。 – Ryan
我纠正了你的语法来帮助讨论(我希望)。 – craig