1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- $PBExportHeader$f_getfromdw.srf
- $PBExportComments$从数据窗口取数函数--自定义函数
- global type f_getfromdw from function_object
- end type
- forward prototypes
- global function string f_getfromdw (string dw_get, string column_get, string cond_get, integer record_get)
- end prototypes
- global function string f_getfromdw (string dw_get, string column_get, string cond_get, integer record_get);//从前台数据窗口定位取一个数据,dw_get=数据窗口的tag,column_get=字段英文名,cond_get=取数定位条件
- int ll_row,li
- string ls_tag2,ls_tag3,ls_return
- datawindow ldw_now,ldw_dw2,ldw_dw3
- if trim(cond_get)='' then cond_get='1=1'
- if isvalid(w_rpt_edit) then
- ldw_dw2=w_rpt_edit.istr_rpt.userdw2
- ldw_dw3=w_rpt_edit.istr_rpt.userdw3
- elseif isvalid(w_rpt_preview) then
- //ldw_dw2=w_rpt_preview.istr_rpt.userdw2
- //ldw_dw3=w_rpt_preview.istr_rpt.userdw3
- end if
- if isvalid(ldw_dw2) then
- ls_tag2=ldw_dw2.tag
- if ls_tag2='' then ls_tag2=ldw_dw2.dataobject
- end if
- if isvalid(ldw_dw3) then
- ls_tag3=ldw_dw3.tag
- if ls_tag3='' then ls_tag3=ldw_dw3.dataobject
- end if
- choose case dw_get
- case ls_tag2
- ldw_now=ldw_dw2
- case ls_tag3
- ldw_now=ldw_dw3
- end choose
- if isvalid(ldw_now) then
- for li=1 to record_get
- ll_row=ldw_now.find(cond_get,ll_row+1,ldw_now.rowcount()+1)
- if ll_row=0 then exit
- next
- if ll_row>0 then
- ls_return=ldw_now.Describe("Evaluate('"+column_get+"',"+string(ll_row)+")")
- end if
- else
- ls_return='前台取数出错'
- end if
- return ls_return
- end function
|