水晶报表组排序 [英] Crystal Reports group sorting

查看:612
本文介绍了水晶报表组排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有每个用户的航班数据记录。下表显示了一个用户ID的示例。



当我按user_id添加分组时,结果报告显示了正确的航班。我们需要按照user_id进行分组(每个user_id只显示一行)日期,但其余字段来自每个用户的最后一行(突出显示的字段)。如何使其显示具有最新日期的整行(我的示例中的第四行)?谢谢!



解决方案

如果您只想基于flightdate对每个userID的查看最新记录,有几个选项。最有效的方法是使用自定义SQL命令,但Crystal可以通过检索所有记录,然后压缩不想看到的记录来实现。



1.按USERID对报表进行分组(报表>组专家>将USERID字段添加到组部分)





3.创建一个运行总计以计算每个组内的记录数(这是我们将如何告诉Crystal抑制我们不记录的记录想要)
- 右键单击​​运行总计在右侧,选择新建。命名它任何你想要的;在字段To Summarize中添加FlightDate,将摘要更改为 COUNT
保留评估为对于每个记录
在重置下,选择组更改并选择USERID



报告应该像这样


  1. 在部分专家中,选择详细信息,按钮旁边的抑制
    输入公式 {#RecountCount}> 1
    现在,您应该只看到每个用户的一条记录




    I have flight data records for each user. The table below shows an example for one user id. I need to group by user_id (show only one row for each user_id) that has the latest flight_date.

    When I added grouping by user_id, the result report displays the right flight date, but the rest of the fields come from the last row for each user (highlighted fields).How do I make it show the entire row with the latest date (4th row in my example)? Thank you!

    解决方案

    If you only want to see the most recent record, per userID, based on the flightdate, there are a few options. The most efficient way is to use a custom SQL command, but Crystal can do it by retrieving all of the records, and then suppressing the records you don't want to see.

    1.Group the report by USERID (Report > Group Expert > Add the USERID field to the group section)

    2. Sort the records by FlightDate ( Report > Sort Expert > Add FlightDate and select Descending NOTE: if FlightDate is not a date, we will need to create a formula to convert it into a date first, otherwise Crystal will treat it as a string and 12/2015 will be higher than 1/2016 (for example)

    3.Create a running total to count the number of records within each group (This is how we will tell Crystal to suppress the records we don't want) --Right click "running Total" on the right hand side, select New. Name it whatever you want; under Field To Summarize add FlightDate, change summary to COUNT Leave Evaluate as "For Each Record" Under Reset, select On Change of Group and select the group for USERID

    The report should look like this

    1. In the Section Expert, select Details and click the formula button next to "Suppress" Enter the formula {#RecountCount} > 1 (Or whatever name your running total has)

    Now you should only see one record for each user

    这篇关于水晶报表组排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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