lunes, 1 de agosto de 2011

LookUp Programado Con Rango de fechas y query

server static void lookupOT(object cont,FormDataSource fds,date fecha_Inicio,date fecha_fin)
{
SysTableLookup myLookup =
SysTableLookup::newParameters(tablenum(SMAServiceOrderTable),cont);

Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
str rangos;
SMAServiceOrderTable _SMAServiceOrderTable;
;
rangos = strfmt("%1..%2",Date2StrXpp(fecha_Inicio)+" 12:00:00 am",Date2StrXpp(fecha_fin)+" 11:59:50 pm");
qbds = query.AddDataSource(tablenum(SMAServiceOrderTable));
qbds.addRange(fieldnum(SMAServiceOrderTable,ServiceDateTime)).value(rangos);
qbds.addGroupByField(fieldnum(SMAServiceOrderTable,Serviceorderid));
qbds.addGroupByField(fieldnum(SMAServiceOrderTable,Description));

myLookup.addLookupField(fieldnum(SMAServiceOrderTable,Serviceorderid));
myLookup.addLookupField(fieldnum(SMAServiceOrderTable,Description));
myLookup.parmQuery(query);

myLookup.performFormLookup();

}

No hay comentarios:

Publicar un comentario