Absolutely useful, nowhere to find
// Simple Dynamic Column Addition
// Prepared by xys_777
// Yongsheng 20100404-dynamically add column f_create_delcol
String ls_rt
String ls_dwsyntax, ls_modfiy
Long ll_posbeg, ll_posend
Int I
Ls_dwsyntax = This. Describe ("datawindow. Syntax ")
Ll_posbeg = pos (lower (ls_dwsyntax), "table (column = ")
Do
I ++
Ll_posend = ll_posbeg
Ll_posbeg = pos (lower (ls_dwsyntax), "column =", ll_posbeg + 1)
Loop while ll_posbeg> 0
Ll_posend = pos (lower (ls_dwsyntax ),"~ R ~ N ", ll_posend)
Ls_modfiy = Replace (ls_dwsyntax, ll_posend + 2,1, "column = (type = char (10) name = is_del dbname = ~ "Is_del ~ ")~ R ~ N ")
string error_create
This. create (ls_modfiy, error_create)
If Len (error_create)> 0 then
MessageBox ("", error_create)
end if
This. settransobject (sqlca)
ls_rt = This. modify ('create column (band = detail id = '+ String (I) + 'alignment = "0" tabsequence = 1 border = "0" color = "33554432" x = "23" Y = "8" Height = "76" width = "1000" name = is_del visible = "0" background. color = "536870912") ')
If Len (ls_rt)> 0 then MessageBox ('', ls_rt)