Crystal Reports for Rational Application Developer 設計工具指南

Select 運算式 (Crystal 語法)

Select 運算式和 If 運算式類似,但是,有時候,您可以使用 Select 運算式撰寫出更簡潔、更少重複的公式,例如,若要驗算 {客戶.傳真號碼} 欄位,決定該區碼屬於美國華盛頓州 (206、360、509) 或加拿大英屬哥倫比亞 (604、250):
//Select example 1
Select {Customer.Fax}[1 To 3]
Case "604", "250" :
"BC"
Case "206", "509", "360" :
"WA"
Default :
"";
緊接在 Select 關鍵字之後的運算式稱為 Select 條件。在上面這個範例中,是 {客戶.傳真號碼}[1 To 3]。Select 運算式嘗試尋找第一個符合 Select 條件的 Case,然後執行位於該 Case 後面冒號後的運算式。假如前面都不符合 Select 條件,就符合Default 條件。請注意,在Default 之後也有一個冒號。
//Same effect as Select example 1
Local StringVar areaCode := {Customer.Fax}[1 To 3];
If areaCode In ["604", "250"] Then
"BC"
Else If areaCode In ["206", "509", "360"] Then
"WA"
Else
"";



Business Objects, SAP 子公司
http://www.taiwan.businessobjects.com/
支援服務
http://www.taiwan.businessobjects.com/support/
產品說明文件網站
http://support.businessobjects.com/documentation/