You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Crystal Reports 2016:如何仅保留最新交易或余额并抑制重复

Crystal Reports 2016: Show Latest Payment + Customer Account Balance

Here's how to set up your report to only display the latest payment record per customer (or show just the balance if there are no payments):

1. Group Your Report by Customer

First, group all records by your customer's unique identifier (e.g., {Customer.CustomerID}). This keeps all transactions for a single customer grouped together, making it easier to target the latest payment.

2. Sort Transactions by Payment Date (Newest First)

  • Go to Report > Record Sort Expert.
  • Add your payment date field (e.g., {Transaction.PaymentDate}) to the sort list, then set the order to Descending. This ensures the most recent payment appears first in each customer group.

3. Suppress All Non-Latest Payment Records

  • Open the Section Expert (right-click the details section and select it from the menu).
  • Select the details section, then click the formula button next to Suppress (No Drill-Down).
  • Use one of these formulas depending on your needs:
    • Keep all payments from the latest date: If multiple payments were made on the same most recent date and you want to show all of them:
      {Transaction.PaymentDate} <> Maximum({Transaction.PaymentDate}, {Customer.CustomerID})
      
    • Keep only one latest record: If you only want a single record even if multiple payments exist on the same date:
      First, create a running total field:
      • Go to Field Explorer > Running Total Fields > New.
      • Name it RecordCountPerCustomer, set the field to count (any transaction field), select Reset On Change of Group (your customer group), and Evaluate For Each Record.
        Then use this suppression formula:
      {#RecordCountPerCustomer} > 1
      

4. Display Balance When There Are No Payments

  • Place your account balance field (e.g., {Account.CurrentBalance}) in either the Group Header or Group Footer section. These sections will render even if there are no payment records in the details section.
  • Optional: Add a text box in the details section with "No payment records found" and set its suppression formula to:
    Count({Transaction.PaymentDate}, {Customer.CustomerID}) > 0
    
    This message will only appear when there are no payments for the customer.

Make sure your dataset links account and transaction tables correctly via the customer ID, and test with different scenarios (no payments, one payment, multiple payments on same/different dates) to confirm everything works as expected.

内容的提问来源于stack exchange,提问作者K. Davis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 21:13:24