4.1 public function string wf_getywname (string hzname)函数
功能:返回"表名.列名",如"department.d_id"。
4.2 public function string wf_getywtype (string hzname)函数
功能:返回列类型。
注释:
(1) f_getoken()函数代码如下:
4.3 public function string wf_dateconvert (string svalue)函数
功能:见程序中注释。
string syear,smonth,sday
date idate
idate = date(svalue)
syear = string(year(idate))
smonth = string(month(idate))
sday = string(day(idate))
svalue = syear + "-" + smonth + "-" + sday
return svalue
end function
public function string wf_datetime (string inputvalue)
inputvalue = trim(inputvalue)
integer position
string bef,aft
/* bef 为日期,aft为时间*/
position = pos(inputvalue," ")
if position = 0 then inputvalue += " 00:00:00"
position = pos(inputvalue," ")
if position = 0 then
return "error"
else
bef = left(inputvalue , position - 1)
aft = right(inputvalue,len(inputvalue) - position)
if (not isdate(bef)) or (not istime(aft)) then
return "error"
end if
end if
//bef = wf_dateconvert(bef)
//return bef + " " + aft
string syear,smonth,sday
date idate
idate = date(bef)
syear = string(year(idate))
smonth = right('00'+string(month(idate)),2)
sday = right('00'+string(day(idate)),2)
return syear+smonth+sday
end function
public subroutine wf_setcolumn (datawindow dw_1, datawindow dw_2)
pfc_n_cst_string lnv_string
String scol, stable_col
String shz, syw, stype, stable
Integer i, row
If Not IsValid(dw_1) Then Return
If Not IsValid(dw_2) Then Return
dw_2.ReSet()
For i =1 To long(dw_1.Object.DataWindow.Column.Count)
scol = dw_1.Describe("#" + String(i) + ".Name") //列名(可变)
stable_col = dw_1.Describe(scol + ".dbName") //所在表.列名(OK)
stable = lnv_string.of_gettoken(stable_col,".") //所在表
syw = stable_col //列名(不变.OK)
shz = trim(dw_1.Describe(scol + "_t.Text")) //中文名
stype = dw_1.Describe(scol + ".ColType") //列类型
if dw_1.Describe(scol + ".Type") = "column" &
and shz <> "!" and shz <> "?" then
shz = lnv_string.of_globalreplace(shz,"'","") //去掉单引号
shz = lnv_string.of_globalreplace(shz,'"','') //去掉双引号
shz = lnv_string.of_globalreplace(shz,"~r~n","_") //去掉换行符
shz = lnv_string.of_globalreplace(shz," ","_") //去掉空格
shz = lnv_string.of_globalreplace(shz,":","") //去掉冒号
shz = lnv_string.of_globalreplace(shz,":","") //去掉冒号
row = dw_2.InsertRow(0)
dw_2.object.data[row,1] = shz
dw_2.object.data[row,2] = syw
dw_2.object.data[row,3] = stype
dw_2.object.data[row,4] = stable
end if
Next
4.4 public function long wf_min (long a, long b, long c)函数
功能:给定三个数a,b,c, 如果a,b,c均为0, 则返回0;否则,返回a,b,c中不为0的数中的最小值.例1: a = 0, b = 0, c = 0 ,则返回0。例2: a = 0, b = 2, c = 6 ,则返回2。例3: a = 9, b = 0, c = 0 ,则返回9。
, long b, long c)函数
文章来源于领测软件测试网 https://www.ltesting.net/