在Crystal Reports中对交叉表列进行排序 [英] Sorting Cross-Tab columns in Crystal Reports

查看:230
本文介绍了在Crystal Reports中对交叉表列进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在Crystal Reports项目中工作,我必须按月显示列中汇总的值的总和.

我必须从参数中指定的日期开始处理一年的范围.因此,我使用了交叉表,按@MONTH_DISPLAY的列分组,定义如下:month({ASIENTOI.DATE}). 重要的事实是,我必须从最早的一个月到一年对列进行排序.意思是: 如果用户将日期设置为12年10月7日,则我必须显示按以下方式排序的列: 七月(2012)-...-六月(2013).

问题在于,Crystal Reports设置了如下范围: 一月(2013)-...-六月(2013)-七月(2012)-...-十二月(2012).

我只是找不到修改分类的方法.

解决方案

通过设计器对交叉表列进行排序的唯一方法是在降序还是升序之间进行选择,这意味着Crystal报表将按字母顺序对字段进行排序.

一种可能的解决方法是,例如,在要在数据源中订购的字符串之前将带下划线的数字放在前面(例如01_July(2012),02_August(2012)... 13_June(2013))并使用升序,然后隐藏数字,请进入交叉表专家"部分,然后在交叉表标签上的列下选择组选项"(对不起,我只有意大利语)

,然后在选项标签上选择下面的选项

单击公式按钮并使用功能

Right(yourField,Length(yourField)-3)

以排除前缀,因此交叉表列上的名称不会为"01_July(2012)",而是"July(2012)".这应该可以解决问题

I've been working in a Crystal Reports project where I have to show a sum of values gruped in columns by months.

I've to proccess a range of a year from the specified date in parameters. So I've used Cross-Tabs, grouping by columns of @MONTH_DISPLAY, defined by: month({ASIENTOI.DATE}). The important fact is that I've to sort columns by the earliest month to a year from it. Which means: If the user set the date by 10-07-12, I've to show colums sorted like this: July (2012) - ... - June (2013).

The problem is that Crystal Reports set that range like this: Jan (2013) - ... - June (2013) - July (2012) - ... - December (2012).

And I just can't find the way to get that sorting modified.

解决方案

The only way to sort cross-tab columns via designer is choosing between descending or ascending order, this means crystal report will order your fields by alphabetical order.

A possible workaround is, for example, putting numbers with an underscore before the string you want to order in your datasource (like 01_July (2012), 02_August (2012)...13_June (2013)) and use the order ascending, then to hide the numbers, go in the "cross-tab expert" section and on the cross-tab tab choose "group option" under the columns (sorry I only have it in Italian)

and on the option tab choose the options below

click on the formula button and use the function

Right(yourField,Length(yourField)-3)

to exclude the prefix so you will not have "01_July (2012)" on the cross-tab colum but "July (2012)". This should do the trick

这篇关于在Crystal Reports中对交叉表列进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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