Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Impresión (https://www.clubdelphi.com/foros/forumdisplay.php?f=4)
-   -   Crear Parametros dinamicamente en Crystal desde delphi (https://www.clubdelphi.com/foros/showthread.php?t=59236)

richy08 18-08-2008 19:12:39

Crear Parametros dinamicamente en Crystal desde delphi
 
Buenos dias Compañeros tengo un pequeño problema cree un reporte el cual a veces necesito que filtre por tres campos y a veces por dos el detalle es como puede indicarle a crystal que cree en el reporte lso parametros la formula las borro y las vuelvo a genrar el problema es crear los parametros gracias por cualquioer ayuda.

Código Delphi [-]
  Crp_OcuRat.WindowState:=WsMaximized;
      Crp_OcuRat.Selection.Formula.Clear;
      if dbl_Age.KeyValue=Null then
      begin
         Crp_OcuRat.Selection.Formula.Add(' {reserve.sStaRes}=''PA'' and {reserve.dArrivaldate}>={?fecini} and {reserve.dArrivaldate}<={?fecend}');
         Crp_OcuRat.Paramfields[0].currentvalue:=FormatDateTime(' yyyy,mm,dd',Dtp_ArrDat.date);
         Crp_OcuRat.Paramfields[1].currentvalue:=FormatDateTime(' yyyy,mm,dd',dtp_deda.date);
      end
      else
      begin
         Crp_OcuRat.Selection.Formula.Add(' {reserve.sStaRes}=''PA'' and {reserve.dArrivaldate}>={?fecini} and {reserve.dArrivaldate}<={?fecend} and {sources.sSourceCode}={?agencie}');
         Crp_OcuRat.Paramfields[0].currentvalue:=FormatDateTime(' yyyy,mm,dd',Dtp_ArrDat.date);
         Crp_OcuRat.Paramfields[1].currentvalue:=FormatDateTime(' yyyy,mm,dd',dtp_deda.date);
         Crp_OcuRat.Paramfields[2].currentvalue:=dbl_age.KeyValue;
      end;
        Crp_OcuRat.Show;

Caral 18-08-2008 19:34:28

Hola
Seguro me equivoco, pero:

Código Delphi [-]
Crp_OcuRat.WindowState:=WsMaximized;
      Crp_OcuRat.Selection.Formula.Clear;
      if dbl_Age.KeyValue=Null then
      begin
         Crp_OcuRat.Selection.Formula.Add('reserve.sStaRes =''PA'' and reserve.dArrivaldate >= :?fecini and reserve.dArrivaldate <= :?fecend');
         Crp_OcuRat.Paramfields[0].currentvalue:=FormatDateTime(' yyyy,mm,dd',Dtp_ArrDat.date);
         Crp_OcuRat.Paramfields[1].currentvalue:=FormatDateTime(' yyyy,mm,dd',dtp_deda.date);
      end
      else
      begin
         Crp_OcuRat.Selection.Formula.Add('reserve.sStaRes =''PA'' and reserve.dArrivaldate >= :?fecini and reserve.dArrivaldate <= :?fecend and sources.sSourceCode = :?agencie');
         Crp_OcuRat.Paramfields[0].currentvalue:=FormatDateTime(' yyyy,mm,dd',Dtp_ArrDat.date);
         Crp_OcuRat.Paramfields[1].currentvalue:=FormatDateTime(' yyyy,mm,dd',dtp_deda.date);
         Crp_OcuRat.Paramfields[2].currentvalue:=dbl_age.KeyValue;
      end;
        Crp_OcuRat.Show;
Desconozco por que el uso del signo de interrogarion en los parametros.:confused:, si el campo se llama asi, pues estará bien.:D
Me da la impresion de que usas Access, me equivoco?.
Saludos

richy08 18-08-2008 19:37:18

Hola gracias caral por contestarme pero no para nada ni loco utilizaria access:eek: utilizo mssql2005 y pues ya encontre la solucion jeje la posteo

Código Delphi [-]
 Crp_OcuRat.Selection.Formula.Clear;
      if dbl_Age.KeyValue=Null then
      begin
         Crp_OcuRat.Selection.Formula.Add(' {reserve.sStaRes}=''PA'' and {reserve.dArrivaldate}>={?fecini} and {reserve.dArrivaldate}<={?fecend}');

      end
      else
      begin
         Crp_OcuRat.Selection.Formula.Add(' {reserve.sStaRes}=''PA'' and {reserve.dArrivaldate}>={?fecini} and {reserve.dArrivaldate}<={?fecend} and {sources.sSourceCode}='+''''+Dbl_Age.KeyValue+'''');
      end;
        Crp_OcuRat.Paramfields[0].currentvalue:=FormatDateTime(' yyyy,mm,dd',Dtp_ArrDat.date);
        Crp_OcuRat.Paramfields[1].currentvalue:=FormatDateTime(' yyyy,mm,dd',dtp_deda.date);
        Crp_OcuRat.Show;

richy08 04-09-2008 15:14:05

:confused::confused::confused:
Cita:

Empezado por lasersguru (Mensaje 311729)
Your post rocks!

:confused::confused:


La franja horaria es GMT +2. Ahora son las 09:59:52.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi