在 Crystal Report 中存储当前行的上一行值 [英] Store Previous row value for current row in Crystal Report

查看:15
本文介绍了在 Crystal Report 中存储当前行的上一行值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检索当前行中的前一行值,如下所示(Crystal Report 2008):

I want to retrieve previous row value in current row just like below (Crystal Report 2008):

+------------+-----------------+----------+------------+----------------+
| Date       | PreviousBalance | Loan     | Collection | CurrentBalance |
+============+=================+==========+============+================|
| 14/02/2012 | 00.00           | 10000.00 | 00.00      | 10,000.00      |
| 15/02/2012 | 10,000.00       | 00.00    | 500.00     | 9,500.00       |
| 16/02/2012 | 9,500.00        | 00.00    | 500.00     | 9,000.00       |
| 18/02/2012 | 9,000.00        | 5,000.00 | 00.00      | 14,000.00      |
+------------+-----------------+----------+------------+----------------+

推荐答案

比看起来容易:

  1. 为字段 {table.Loan} 创建两个运行总计,一个用于 Loan {#TLoan},另一个用于 Collection {#TCol} 用于字段 {table.Collection}.

  1. Create two Running Totals one for Loan {#TLoan} for the field {table.Loan} and one for Collection {#TCol} for the field {table.Collection}.

创建公式:{@Total},内容如下:

Create a Formula: {@Total} with following content:

{#TLoan}-{#TCol}

这将具有 CurrentBalance 值.

  1. 创建另一个公式:{@Prev},内容如下:
  1. Create another formula: {@Prev} with following content:

{@Total}-{table.Loan}+{table.Collection}

这将具有 PreviousBalance 值.

使用这种方法不需要复杂的公式,结果是预期的.

Using this approach don't need complicated formulas and the result is the expected.

希望对你有帮助!

这篇关于在 Crystal Report 中存储当前行的上一行值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆