Crystal Reports 中的条件运行总计
使用 VS 2008 Crystal Reports,我想对根据组更改计算的公式进行运行总计。当我单击“添加运行总计”时,此公式不会出现在“可用表和字段”列表中。
这是逻辑:
在更改组的组时
if CalculatedValue > 0 then
ReportRunningTotal1 += CalculatedValue
else
ReportRunningTotal2 += CalculatedValue
我可以在运行总计中指定条件吗?如果不是,我还能怎么做呢?
更多信息:我正在对数据库字段 BillableHours
的值进行名为 GroupRunningTotal
的运行总计。在更改组时,我将 GroupRunningTotal
与该组 MaxHours
的数据库字段进行比较,并在团体级别。
今天适用 - 把它想象成选举团 - 赢得选举的人并不取决于总票数,而是取决于选举团中的票数。
Using VS 2008 Crystal Reports, I would like to do a running total on a formula that is calculated on a group change. When I click on add a running total, this formula does not appear in the Available Tables and Fields list.
This is the logic:
On Change Group of group
if CalculatedValue > 0 then
ReportRunningTotal1 += CalculatedValue
else
ReportRunningTotal2 += CalculatedValue
Can I specify a condition in a running total? If not, how else could I do this?
More info: I am doing a running total called GroupRunningTotal
of the value of db field BillableHours
. At change of group, I am comparing GroupRunningTotal
to a db field for that group MaxHours
, and I display a result of MaxHours - GroupRunningTotal
at the group level.
Appropriate today - Think of it like the electoral college - the person who wins the election does not depend on total number of votes, but of number of votes in the electoral college.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将您的问题解释为您想要将一个运行总计中的所有负值 (RT_Neg) 和另一个运行总计中的所有正值 (RT_Pos) 相加。怎么样:
生成RT_Neg运行总计。在要汇总的字段下,将您的 {Tbl1}.{Amount} 相加。在评估下,输入“{Tbl1}.{Amount}<0”作为您的自定义公式。切勿重置。
计算RT_Pos运行总计。在要汇总的字段下,将您的 {Tbl1}.{Amount} 相加。在评估下,输入“{Tbl1}.{Amount}>0”作为您的自定义公式。切勿重置。
在组页脚中插入两个运行总计(如果将它们放在页眉中,则可能无法正确求和)
,您可以:
我认为这两个选项之一将帮助您实现目标。
I'm interpreting your question to mean that you want to add up all the negative values in one running total (RT_Neg) and all the positive values in another (RT_Pos). How about this:
Make the RT_Neg running total. Under Field to Summarize, sum your {Tbl1}.{Amount}. Under evaluate, enter "{Tbl1}.{Amount}<0" as your custom formula. Never reset.
Make the RT_Pos running total. Under Field to Summarize, sum your {Tbl1}.{Amount}. Under evaluate, enter "{Tbl1}.{Amount}>0" as your custom formula. Never reset.
Insert both running totals in the group footer (if you put them in the header, it may not sum properly)
Alternatively, you can:
I think one of these 2 options will get you to your goal.
您很可能无法使用一个 RT 字段作为其他 RT 字段的条件。您可以使用公式,放置在组页脚上并评估“whileprintingrecords()”;在这些公式中,您可以分配/求和到一些变量中,并在报告末尾显示这些变量。关于如下(仅通用想法,您还需要初始化和显示例程):
You most likely cannot use one RT field as condition for other RT field. You can use formulas, placed on group footer and evaluated 'whileprintingrecords()'; in these formulas you can assign/sum into some variables and display these variables at the end of report. About like next (generic idea only, you need initialization and display routines as well):