



下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、英文原版解釋:PowerBuilder This statement defines the filter expression for dw_Employee as the value of format1: dw_Employee.SetFilter(format1)The following statements define a filter expression and set it as the filter for dw_Employee. With this filter, only those rows in which the cust_qty column exceeds
2、 100 and the cust_code column exceeds 30 are displayed. The final statement calls Filter to apply the filter:string DWfilter2DWfilter2 = "cust_qty > 100 and cust_code >30"dw_Employee.SetFilter(DWfilter2)dw_Employee.Filter( )The following statements define a filter so that emp_state o
3、f dw_Employee displays only if it is equal to the value of var1 (in this case ME for Maine). The filter expression passed to SetFilter is emp_state = ME:string Var1Var1 = "ME"dw_Employee.SetFilter("emp_state = '"+ var1 +" '")The following statements define a fil
4、ter so that column 1 must equal the value in min_qty and column 2 must equal the value in max_qty to pass the filter. The resulting filter expression is:#1=100 and #2=1000The sample code is:integer max_qty, min_qtymin_qty = 100max_qty = 1000dw_inv.SetFilter("#1="+ String( min_qty) & +
5、" and #2=" + String(max_qty)The following example sets the filter expression to null, which causes PowerBuilder to display the Specify Filter dialog box. Then it calls Filter, which applies the filter expression the user specified:string null_strSetNull(null_str)dw_main.SetFilter(null_str)
6、dw_main.Filter()中文解釋(非對應):函數作用:為DataWindow或者DataStore指定數據過濾規則。通常在調用該函數前使用函數Retrieve將數據檢索到客戶端,該函數可以決定檢索到客戶端的這些數據哪些可以顯示,哪些不能顯示。該函數對客戶端的數據進行操作,和后臺數據庫沒有任何關系。在設置完過濾規則后使用函數Retrieve檢索數據是不合理的,每次設置過濾規則后都檢索數據,這樣的執行效率很低。需要注意的是,該函數緊緊是設置過濾規則,并不進行過濾。函數Filter是進行過濾的,使用最近設置好的過濾規則對數據進行過濾。函數語法:integer dwcontrol.SetFil
7、ter ( string format )ldwcontrol:要為其設定過濾規則的DataWindow、DataStore或者下拉子數據窗口控件的名稱;lformat:作為過濾規則的表達式,該表達式的返回值應該是Boolean類型,或者是True、或者是False。如果表達式返回值為Null,則在執行函數Filter時自動彈出對話框讓用戶指定過濾規則。在表達式中可以使用數據窗口對象函數、列名、列號、數字、字符串等。如果用到了列號,則應該以開頭、后面緊跟數字來表示。多個條件可以使用邏輯運算符進行聯結,一個非常良好的習慣是每個條件都應該使用括號。這樣既可以保證表達式的清晰,又可以避免一些Bug。
8、后面的代碼實例中會講到。返 回值:數字類型,1表示執行成功,-1表示執行失敗。該函數的返回值沒有多大意義,很少在程序中使用該返回值。代碼實例:例1:使用列名進行過濾。string ls_filter ls_filter = "cust_qty > 100 and cust_code >30"dw_Employee.SetFilter(ls_filter)dw_Employee.Filter( )例2:必須使用括號的情況。下面的腳本在邏輯上看起來沒有什么問題:String ls_filterls_filter = “name like 張% and article
9、_title like %計算機%”dw_1.SetFilter()dw_1.Filter()實際上,上面的程序是不能正確執行的。將過濾規則作如下改動就可以了:ls_filter = “(name like 張%) and (article_title like %計算機%)”例3:取消過濾規則。下面兩個語句都能實現:語句1:dw_1.SetFilter(“”)語句2:dw_1.SetFilter(“1=1”)例4:下面的語句在運行時可以讓用戶自己指定過濾規則:String ls_nullSetNull(ls_null)dw_1.SetFilter(ls_null)dw_1.Filter()例
10、5:下面腳本可以判斷數據窗口中是否有主鍵重復的數據。假設數據窗口中的主鍵是dept_id:string ls_fieldname/主鍵名稱long ll_rc/數據窗口中總的數據行數ls_fieldname = "dept_id"dw_1.SetFilter("1=1")/取消過濾規則,顯示全部的數據dw_1.Filter()/過濾ll_rc = dw_1.RowCount()/保存數據行數dw_1.SetSort(ls_fieldname + " A")/用主鍵進行排序dw_1.Sort()/下面語句是核心語句。該過濾規則的含義是:只顯示相鄰行不同的數據。dw_1.SetFilter(ls_fieldname + " <> " + ls_fieldnam
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 工業電源技術及其發展趨勢
- 工業設計與商業價值的結合實踐
- 工作中的時間管理工具應用
- 工作效率優化與管理效能提升
- 工業風格建筑特色及設計要素
- 工程制圖中對于坐標和空間的理解及表達方式
- 工作場所安全管理與職業病預防
- 工作匯報中的有效表達策略-基于故事化的視角
- 工廠設備的日常維護與保養
- 工程設計與施工技術探討
- 了解中醫心理學在臨床中的應用
- 《人本主義學習理論》課件
- 彩鋼板消防安全培訓課件
- 2023年洪江市社區工作者招聘考試真題
- 基層領導干部的官德修養(zk-1)課件
- 責任與擔當班會課件
- 煙草公司設施安裝施工方案
- 解毒藥及機理(動物藥理學課件)
- 新修訂《土地管理法》考試題庫及答案
- 小老虎過生日
- 2023-2024學年廣西壯族自治區南寧市小學語文六年級期末深度自測試卷詳細參考答案解析
評論
0/150
提交評論