1. 新建一个窗口,命名为w_query。在窗口中放入一个数据窗口控件,命名为dw_master。在dw_master中放入一个数据窗口;放置一个按钮,命名为cb_query。见下图:
http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912539417.jpg';" hspace=3 src="http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912539417.jpg" width=509 align=center vspace=1 border=1>
2. 新建一个结构(structure)命名为str_result_column,其参数如下:
http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912540203.jpg';" hspace=3 src="http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912540203.jpg" align=center vspace=1 border=1>
3. 在dw_master增加两个用户事件,命名为ue_action_query、ue_action_refresh。
4. 在cb_query中增加如下代码:
http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912540593.jpg';" hspace=3 src="http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912540593.jpg" align=center vspace=1 border=1>
5. 在窗口的Open事件中增加如下代码:
dw_master.setTransObject(sqlca)
6. 在dw_master的ue_action_query中增加如下代码:
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)
[1] [2] [3] [4] [5] [6] [7] 下一页
7. 在dw_master的ue_action_refresh事件中增加如下代码:
dw_master.retrieve()
8. 新建一个窗口,命名为wroot_dw_query,该窗口用以进行模糊查询。其设计完成后界面如下所示:
http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912541375.jpg';" hspace=3 src="http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912541375.jpg" align=center vspace=1 border=1>
其中"执行"按钮名为"cb_exec"、"返回"按钮名为"cb_exit"、"返回"按钮下的数据窗口名为dw_column,其dataObject为d_column_set、中间的数据窗口名为dw_where,其dataObject为d_where。
9. d_column_set的设计完成界面如下所示:
http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912541509.jpg';" hspace=3 src="http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912541509.jpg" align=center vspace=1 border=1>
10. 其sql为:
http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912541838.jpg';" hspace=3 src="http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912541838.jpg" align=center vspace=1 border=1>
11. dw_where的设计完成界面如下:
http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912541598.jpg';" hspace=3 src="http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912541598.jpg" align=center vspace=1 border=1>
12. 其sql为:
http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912541453.jpg';" hspace=3 src="http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912541453.jpg" align=center vspace=1 border=1>
上一页 [1] [2] [3] [4] [5] [6] [7] 下一页
13. 属性和代码如下:
1. wroot_dw_query属性:
X = 9 Y = 1132 Width = 2912 Height = 712
Visible = true Enabled = true TitleBar = true Title = "定位查询"
ControlMenu = true Border = true WindowType = response! WindowState = normal!
BackColor = 79741120
2. 窗口实例变量:
Boolean ib_changed
Long MaxEditRow = 1
String sWhere, oldsql, orisql, is_title, is_section = 'WhereClause'
DataWindow dw_result,dw_detail
pfc_n_cst_string inv_string
string sSyntax
注释:a.pfc_n_cst_string 为PFC用户对象。
3. 窗口事件代码:
3.1 close 事件:
http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912542995.jpg';" hspace=3 src="http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912542995.jpg" align=center vspace=1 border=1>
功能:将用户本次所输入的查询条件记录到文件sIniFile的WhereClause1...n小节中去以备下次启动时置初始查询条件。
3.2 open 事件:
功能:设置初始值,具体请看代码中的注释。
integer i, row, li_where_row = 10
string tmp
str_result_column lstr_1
//结构str_result_column的成员adw_result指查询结果所产生作用的dw
// 成员adw_column指在本窗口查询条件所要显示的dw
lstr_1 = Message.PowerObjectParm
dw_result = lstr_1.adw_result
dw_detail = lstr_1.adw_column
if isnull(dw_result) or not isvalid(dw_result) then return
if isnull(lstr_1.adw_column) or not isvalid(lstr_1.adw_column) then return
window act_w
act_w=MainWindow.getactivesheet()
x = act_w.x + 8
y = act_w.y + act_w.height - height+258
width = act_w.width
cb_exec.x=width - cb_exec.width -80
cb_exit.x=width - cb_exec.width -80
dw_where.x=10
dw_where.Width = width - 2 * dw_where.X - cb_exec.width -100
//-----s
dw_column.visible = False
wf_setcolumn(lstr_1.adw_column, dw_column)
//orisql = dw_result.Object.DataWindow.Table.Select //原始语法,close中用.
orisql = dw_result.GetSqlSelect() //上句对CrossTab无效
oldsql = lower(orisql)
For i = 1 to li_where_row
dw_where.InsertRow(0)
Next
dw_where.setrowfocusindicator(Hand!)
dw_where.ScrollToRow(0)
dw_where.SetColumn("column1")
cb_exec.SetFocus()
datawindowchild dwc
dw_where.GetChild("column1",dwc)
dwc.SetTransObject(sqlca)
dwc.Reset()
For i = 1 to dw_column.RowCount()
tmp = dw_column.GetItemString(i,1)
row = dwc.InsertRow(0)
dwc.SetItem(row,1,tmp)
Next
//将用户上次所输入的查询条件从文件sIniFile的WhereClause1...n小节中取出来,
//本次启动时置为初始查询条件.
window w_parent
if dw_result.GetParent().typeof() = window! then
w_parent = dw_result.GetParent()
is_title = w_parent.title
else
is_title = dw_result.DataObject
end if
ib_changed = True
row = 0
tmp = ''
is_title = gnv_app.is_regkey + '\' + is_title + '\' + scname
For i = 1 to li_where_row
RegistryGet(is_title, is_section + String(i), RegString!, tmp)
//tmp = ProfileString(sinifile,is_title,"WhereClause" + string(i),"")
if tmp <> "" and (Not IsNull(tmp)) then
//SetProfileString(sinifile,is_title,"WhereClause" + string(i),"")
RegistrySet(is_title, is_section + String(i), RegString!, '')
row ++
dw_where.object.data[row,1] = inv_string.of_gettoken(tmp, ",")
dw_where.object.data[row,2] = inv_string.of_gettoken(tmp, ",")
dw_where.object.data[row,3] = inv_string.of_gettoken(tmp, ",")
dw_where.object.data[row,4] = inv_string.of_gettoken(tmp, ",")
dw_where.object.data[row,5] = inv_string.of_gettoken(tmp, ",")
dw_where.object.data[row,6] = inv_string.of_gettoken(tmp, ",")
end if
Next
MaxEditRow = row // MaxEditRow 为dw_where中当前已编辑过的最大行的行号.实例变量.
If MaxEditRow = 0 Then MaxEditRow = 1
上一页 [1] [2] [3] [4] [5] [6] [7] 下一页
4. 函数:
4.1 public function string wf_getywname (string hzname)函数
功能:返回"表名.列名",如"department.d_id"。
http://www.fmm7.comhttp://www.fmm7.com/jsjc/UploadFiles_3246/200605/200651912542899.jpg';" hspace=3 src="http://www.fmm7.comhttp: