2012-04-19 103 views
0

我必須設計一個水晶報表,我必須從數據庫的特定字段中檢索值。但是,此字段後面增加數字即1到10000,然後10000至20000,20000〜30000等多項條目..Crystal Reports按值分組

現在我想將它們分組的方式,1〜10000爲一組,10000另一個爲15000,另一個爲15000至20000。我怎麼做?我會很感激迴應。

回答

1

建立一個水晶公式,類似於:

 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' 

- 和組上你的新配方。

1

你可能會考慮SELECT表達:

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