从一个datawindow找出与另一个datawindow条件相符的数据

iwithyou 2002-09-18 11:45:41
有dw_1和dw_2,在dw_1中点击一行,要在另一个dw中显示与之相对应的数据。如下:
long n_row
string n_id
n_row=dw_1.getrow()
n_id=dw_1.getitemstring(n_row,"列名")
dw_2.retrieve(n_id)

不能完成。请问怎么修改?
...全文
23 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
are2000 2002-09-18
  • 打赏
  • 举报
回复
不好意思刚才写的retrieve(:参数)是错误的。

are2000 2002-09-18
  • 打赏
  • 举报
回复
检查数据窗口对象中定义的参数个数和参数类型是否和retrieve()函数提供的一致。
are2000 2002-09-18
  • 打赏
  • 举报
回复
retrieve(:参数)
iwithyou 2002-09-18
  • 打赏
  • 举报
回复
在reset前面加上可以了。
现在是怎么才能不显示输入参数value的提示框?
joss 2002-09-18
  • 打赏
  • 举报
回复
先写dw_2.settransobject(sqlca)
再retrieve(n_id)

不过你的参数类型一定要与n_id一致的哦!
warchild 2002-09-18
  • 打赏
  • 举报
回复
scrolltorow(find(..))
pufan 2002-09-18
  • 打赏
  • 举报
回复
你在dw_2得constructor事件中写:
this.settransobject(sqlca)
试试
iwithyou 2002-09-18
  • 打赏
  • 举报
回复
可以了。我原来放在click中。
dw_2的dw中有retrieve参数,但是每次运行时先出现:
database transaction information not available.
call settrans or settransobject function。
然后提示输入value。
请问怎么解决?
pufan 2002-09-18
  • 打赏
  • 举报
回复
在rowfocuschanged事件中写:
long n_row
string n_id
n_row=dw_1.getrow()
n_id=dw_1.getitemstring(n_row,"列名")
dw_2.reset()
dw_2.retrieve(n_id)
另: 你的dw_2的dw对象有retrieve参数吗?
pufan 2002-09-18
  • 打赏
  • 举报
回复
在rowfocuschanged中写:
this.selectrow(0,false)
this.selectrow(curretrow,true)
iwithyou 2002-09-18
  • 打赏
  • 举报
回复
可以了,原来没有设置datawindow的列的排序。
如果要这一行都显示不同,该如何写?
pufan 2002-09-18
  • 打赏
  • 举报
回复
数据窗口的constuctor是否有脚本?
open中的脚本是什么?
iwithyou 2002-09-18
  • 打赏
  • 举报
回复
原来是datawindow的列没有排序。
iwithyou 2002-09-18
  • 打赏
  • 举报
回复
这个放在dw的哪个事件下?
数据窗口的retrieve函数我是放在window的open下的。
把这几句放在其后不行?
pufan 2002-09-18
  • 打赏
  • 举报
回复
写在数据窗口的retrieve函数之后
iwithyou 2002-09-18
  • 打赏
  • 举报
回复
但是看不到光标在上面啊。怎么使那里的颜色不同?
pufan 2002-09-18
  • 打赏
  • 举报
回复
dw_1.scrooltorow(rownumber)
dw_1.setcolumn(columnnumber)
dw_1.setfocus()
liangshi001 2002-09-18
  • 打赏
  • 举报
回复
dw_1.scrolltorow(3)
iwithyou 2002-09-18
  • 打赏
  • 举报
回复
不好意思,原来是我在window的open加了retrieve。
要在开始运行时焦点自动在dw_1的某一行,怎么写?
dw_1.setfocus()//?
数据存在主次表时,当更新了次表数据后,主表数据在后台有更变时。可利用刷新主表当前行的方法重显主表数据。 /************************************************************ 函数名称: f_refresh_currentrow(adw) 功 能: 刷新DW当前行数据,不可刷新NO update or 带arguments的DW 参数说明: adw 目标DW 返 回 值: integer 成功返回1,失败返回-1 作 者: sean 创建时间: 2010年8月18日 ************************************************************/ string ls_dataobject string ls_keys[] //key Column Name string ls_dbname[] //key field Name string ls_coltype[] //field style string ls_tablenm //table name string ls_condition //sql Condition long ll_currentrow //Current Row numeric long ll_column //Column count integer i datawindow ldw datastore ldatastore ldw=adw if ldw.rowcount( )=0 then return -1 elseif trim(ldw.describe( "datawindow.table.arguments"))<>'?' then messagebox('','刷新数据窗口当前行失败!,数据窗口需要参数',exclamation!) return -1 else ll_currentrow=ldw.getrow( ) FOR ll_column = 1 TO long(ldw.object.datawindow.column.count)//key names If ldw.Describe("#"+string(ll_column)+".key") ='yes' Then i++ ls_keys[i]=ldw.Describe("#"+string(ll_column)+".name") ls_dbname[i]=ldw.Describe("#"+string(ll_column)+".dbname") ls_coltype[i]=ldw.Describe("#"+string(ll_column)+".coltype") End If NEXT if upperbound(ls_keys[])=0 then messagebox('','刷新数据窗口当前行失败!,没有主键',exclamation!) return -1 else ls_tablenm=left(ls_dbname[1],pos(ls_dbname[1],'.') -1) //table name for i=1 to upperbound(ls_keys[]) if pos('numb,deci,long,',LeftA(ls_coltype[i],4) +',')>0 then ls_condition+="and "+ls_dbname[i]+"="+string(f_getitem(ldw,ll_currentrow,ls_keys[i])) else ls_condition+="and "+ls_dbname[i]+"='"+string(f_getitem(ldw,ll_currentrow,ls_keys[i]))+"'" end if next ls_condition=mid(ls_condition,4) //sql Condition ldatastore=create datastore ldatastore.dataobject=ldw.dataobject ldatastore.settransobject( sqlca) if f_addwhere_retrieve(ldatastore,ls_condition)=1 then if ldatastore.rowcount( )=1 then ldw.object.data[ll_currentrow]=ldatastore.object.data[1] ldw.setitemstatus( ll_currentrow, 0, primary!, NotModified!) //if ldw.getrow( )<>ll_currentrow then ldw.scrolltorow( ll_currentrow) end if else messagebox('','刷新数据窗口当前行失败!,条件语法错误',exclamation!) return -1 end if destroy ldatastore end if end if

611

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder DataWindow
社区管理员
  • DataWindow社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧