Crystal Reports Grouping by Values

不羁岁月 提交于 2019-12-11 06:36:36

问题


I have to design a crystal report in which I have to retrieve values from a particular field in a database. But this field has many entries that follow increase numerically i.e., 1 to 10000, then 10000 to 20000, 20000 to 30000 etc..

Now I want to group them in a way that 1 to 10000 are in one group, 10000 to 15000 in another and 15000 to 20000 in another. How do I do that? I will be grateful for a response.


回答1:


Set up a Crystal formula, similar to:

     if {myTable.myField} >= 1 and {myTable.myField} <= 10000 then 'A'
else if {myTable.myField} > 10000 and {myTable.myField} <= 15000 then 'B'
else if {myTable.myField} > 15000 and {myTable.myField} <= 20000 then 'C'

- and group on your new formula.




回答2:


You might consider the SELECT expression:

SELECT {table.field}
CASE 1 TO 10000: "A"
CASE 10001 TO 15000: "B"
CASE 15001 TO 20000: "C"
DEFAULT: "ERROR"


来源:https://stackoverflow.com/questions/10223722/crystal-reports-grouping-by-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!