遍历数据窗口对象

string ls_msg
string ls_datatype
string ls_value,ls_tag
string ls_objects
String ls_obj[], ls_Obj_Band[] 
long li_pos, li_i

ls_Objects = dw_1.Describe("datawindow.objects") 
ls_Objects += '~t' 
DO While ( Pos( ls_Objects, "~t" ) > 0) 
    li_i ++ 
    li_pos = Pos( ls_Objects, "~t" ) 
    ls_obj[li_i] = Left( ls_Objects, li_pos - 1 ) 
    ls_Objects = Right( ls_Objects, Len(ls_Objects) - li_pos) 
	 
	if dw_1.describe(ls_obj[li_i]+".band") = "detail" then
		if dw_1.describe(ls_obj[li_i]+".type") = "column" or dw_1.describe(ls_obj[li_i]+".type") = "compute" then
			
			ls_tag = dw_1.describe(ls_obj[li_i]+".tag")
			if isnull(ls_tag) or ls_tag = "" then continue //tag为空则继续
			
			ls_datatype = dw_1.describe(ls_obj[li_i]+".ColType") 
			choose case left(ls_datatype,4)
			case "char"
				ls_value = dw_1.getitemstring(1,ls_obj[li_i])
			case "long"
				ls_value = string(dw_1.getitemnumber(1,ls_obj[li_i]))
			case "deci"
				ls_value = string(dw_1.getitemdecimal(1,ls_obj[li_i]))
			case "date"
				ls_value = string(dw_1.getitemdatetime(1,ls_obj[li_i]),"YYYY-MM-DD")
			end choose
			if isnull(ls_value) or ls_value="" then 
				ls_msg += ls_tag + "~r~n"
			end if
		end if
	end if
	 
loop


你可能感兴趣的:(sql)