/*====================================================================
> Function: w_cwjk_xhyy.wf_dw_init
>--------------------------------------------------------------------
> 描述: 按excel表格列名,创建对应字段,用于部分接口对应字段导出文件
>--------------------------------------------------------------------
> 参数:?
> ?? ?datawindow adw
> ?? ?long al_end?? ?
>--------------------------------------------------------------------
> 返回: ?long
>--------------------------------------------------------------------
> 作者:?? ?wxk?? ??? ?日期: 2023-12-29 15:11:20
>--------------------------------------------------------------------
>?? ?CopyRight(c)
>--------------------------------------------------------------------
> 修改历史:?
>?? ?wf_dw_init(dw_10,18)//18个字段
====================================================================*/
string ls_sql,ls_colname,ls_cols,ls_err
long i,j,ll_index
//asc码其中48~57为0到9十个阿拉伯数字;65~90为26个大写英文字母,97~122号为26个小写英文字母
for i=1 to al_end//142?? ?
?? ?if ll_index=0 then ll_index=0?? ?
?? ?if j=0 then?
?? ??? ?ls_colname=char(ll_index+97)//+'='+string(ll_index)
?? ?else
?? ??? ?ls_colname=char((j -1)+97)+char(ll_index+97)//+'='+string(j -1)+string(ll_index)
?? ?end if
?? ?//ls_cols=ls_cols+ls_colname+'~r~n'
?? ?ll_index++
?? ?if ll_index>25 then?
?? ??? ?ll_index=0
?? ??? ?j++
?? ?end if?
?? ?ls_cols=ls_cols+'space(50) as t_'+ls_colname
?? ?if i<al_end then ls_cols=ls_cols+',~r~n'
next
ls_sql="select "+ls_cols+" from md where 1>2"
adw.dataobject=' '
adw.create(sqlca.syntaxfromsql(ls_sql,"style(type=grid)",ls_err))
adw.settransobject(sqlca)
adw.retrieve()
if len(ls_err)>0 then?
?? ?messagebox('wf_dw_init',ls_err)
?? ?return -1
end if?
return 1