This paper mainly introduces how to make fuzzy query of data window according to the fields in the Data window in PB. The code examples for this system are demonstrated using power Builder6.5.
Code and Design:
1. Create a new window, named W_query. Put a data window control in the window, named Dw_master. Put a data window in the Dw_master, and place a button named Cb_query. See figure below:
2. A new structure (structure) is named Str_result_column, and its parameters are as follows:
3. Add two user events in Dw_master, named Ue_action_query, Ue_action_refresh.
4. Add the following code in the Cb_query:
5. Add the following code to the Open event in the window:
dw_master.setTransObject(sqlca)
6. Add the following code to the ue_action_query of Dw_master:
str_result_column lstr_1
//结构str_result_column的成员adw_result指查询结果所产生作用的dw
// 成员adw_column指在本窗口查询条件所要显示的dw
lstr_1.adw_result = this
lstr_1.adw_column = this
OpenWithParm(wroot_dw_query, lstr_1)
7. Add the following code to the Ue_action_refresh event in Dw_master:
dw_master.retrieve()
8. Create a new window named Wroot_dw_query, which is used for fuzzy queries. After its design is complete, the interface is as follows:
Where the "execute" button named "Cb_exec", "return" button named "Cb_exit", "return" button under the data window named Dw_column, its DataObject is d_column_set, the middle of the data window named Dw_where, Its DataObject is d_where.
9. The D_column_set design interface is as follows: