Ver Mensaje Individual
  #8  
Antiguo 20-05-2011
inad20 inad20 is offline
Registrado
 
Registrado: feb 2008
Posts: 5
Reputación: 0
inad20 Va por buen camino
Cita:
Empezado por Lepe Ver Mensaje
hace años hice estas rutinas que aún tiro de ellas:
Código Delphi [-]uses CheckLst, // marcarchklb Classes // QuotedList ; // y puede que haga falta alguno mas. // devuelve los items de la siguiente forma : 'aaaa','bbbbb','ccc' function QuotedList( Items: TStrings):string; function QuotedListChklb( ctrl:TCheckListBox;const SoloChecked:Boolean = True):string; .... function QuotedListchklb( ctrl:TCheckListBox;const SoloChecked:Boolean = True):string; var i:integer; begin result := ''; with ctrl do for i:= 0 to Items.Count-1 do if SoloChecked then begin if Checked[i] then Result := Result +QuotedStr(Items[i])+','; end else Result := Result +QuotedStr(Items[i])+','; if Length(Result)>0 then Delete(Result,Length(Result),1); //quito la ultima coma end; function QuotedList( Items: TStrings):string; var i:integer; begin result := ''; for i:= 0 to Items.Count-2 do Result := Result +QuotedStr(Items[i])+','; if Items.count > 0 then Result := Result + quotedstr(Items[Items.count-1]); end;


Yo quitaría el parámetro y concatenaría con la salida de quotedList, algo así:
Código Delphi [-]IBQuery1.SQL.Text := 'SELECT D.DOCTO_CC_ID,D.FOLIO,................ '+ '.....................................................................................'+ 'left outer join SALDO_CARGO_CC_S ( D.DOCTO_CC_ID,D.FECHA,0,'N') s '+ 'on(D.docto_cc_id=cargo_id) '+ 'WHERE ( D.CONCEPTO_CC_ID = 4 ) and (s.saldo_cargo<>0) and '+ '(D.clave_cliente in ('+QuotedList(ListBox.Items)+'))';


Saludos
que tal Lepe Gracias por tu respuesta pero no entiendo muy bien como implementar tu rutina no se si me puedes prestar tu ayuda desde ya muchas gracias.
saludos
Responder Con Cita