Este script permite mostrar una consulta SQL en un datawindow de manera dinámica.
string ls_sql;
string ls_sintaxis;
string ls_error;
string ls_estilo;
/*
ls_estilo = "style( type=Grid " + &
"Horizontal_spread = 25 ) " + &
"datawindow( units=1 " + &
"Color= 16777215) " + &
"column( Font.Face='Verdada' " + &
"Font.Height=-9 " + &
"width=1527 " + &
"Font.Weight=600) " + &
"text( Font.Face='Verdana'" + &
"Font.Height=-9 " + &
"Font.Weight=400 " + &
"Border=6)";
*/
ls_estilo = "style( type=Grid )";
ls_sql = Message.StringParm
ls_sintaxis = SQLCA.SyntaxFromSQL(ls_sql,ls_estilo, ls_error)
dw_sql.create(ls_sintaxis);
dw_sql.SetTransObject(sqlca);
string colname, colvariable
int i, icount
icount = integer(dw_sql.describe('DataWindow.Column.Count'))
FOR i = 1 TO icount
colvariable = '#'+string(i)+'.name'
colname = dw_sql.describe(colvariable);
dw_sql.Modify(colname+".Width=500")
//Messagebox ('Information', 'Column name of column #' + string (i) + ' is ' + colname)
NEXT
dw_sql.retrieve();