'获得数据类型列,存入数据字典,已备公式计算
CSql="select FId,FTag,FTagText,CData from ok_Fina_tableIndex where FType<2"
Set CDny=Server.CreateObject("Scripting.Dictionary"
Set Chefee=Server.CreateObject("AdoDB.Recordset"
OpenConn_OKOA : Chefee.open CSql,Conn_OKOA,1,1
Parm=""
For i=0 to Chefee.recordcount-1
Parm=Parm&","&Chefee(1)
Chefee.movenext
Next
Chefee.close
CSql="Select FTid" &Parm&" from Ok_Fina_Tax where tag15='"&UserName&"'"
OpenConn_OKOA : Chefee.open CSql,Conn_OKOA,1,1
If Not Chefee.eof and not Chefee.bof then
CDny.ReMoveAll()
For i=1 to Chefee.fields.count-1
If IsNumeric(Chefee(i)) Then
CDny.Add Chefee.fields(i).name,Chefee(i)
Else
CDNy.Add Chefee.fields(i).name,0
End If
Next
End if
FMAS=Split(FMA,","
FMATS=Split(FMAT,","
For i=0 to ubound(FMAS)-1
If FMAS(i)<>"" and Not IsNull(FMAS(i)) then
'----------------------------------------
'用REPLACE方法把数据字典里的数据替换公式进去
Dim Regx,RepcStr,num,String,Formula,v
Formula=Cstr(FMATS(i))
Set Regx=New RegExp
String="Tag[0-9]+"
Regx.Pattern =String ' 设置模式。
Regx.IgnoreCase =True ' 设置是否区分大小写。
Regx.Global=True
Regx.MultiLine=True
Set RepcStr=Regx.Execute(string)
For each num In RepcStr
Formula =Replace(Formula,Cstr(num),CDny(Cstr(num)))
Next
'----------------------------------------
CKF.Add FMAS(i),Formula
end If
Next