Page 1 of 1

Problem to Validate a data

Posted: Wed May 22, 2019 8:21 am
by Silvio.Falconi
on my app I dont use Dtpicker but two get ad you can see on picture

Image

and I use the XBrDtPicker of Rao to select a adate
as you can see I have problem to validate the get

Code: Select all


 @ 23,144 GET aGet[4] VAR dDataFinale SIZE 120,14 PIXEL OF oFld:aDialogs[1] ;
    BITMAP  ".\bitmaps\cal.bmp" ;
    ACTION (dDataFinale:=XBrDtPicker(Conv_Textdate(dDataFinale,3) , "Seleziona una  data",0.1,,aGet[4] ),;
    IIF( dDataFinale=ctod(""),;
               aGet[4]:cText( "Selezionare una data"),;
               aGet[4]:cText(Convertidata(dDataFinale))),;
           aGet[4]:refresh(),;
           nGiorni:=(Conv_Textdate(dDataFinale,3)-Conv_Textdate(dDataIniziale,3) ),;
            oSay[1]:settext(str(nGiorni)),;
            oSay[1]:refresh(),;
            oSay[2]:refresh()) VALID ValidareData( Conv_Textdate(dDataIniziale,3), Conv_Textdate(dDataFinale,3) )


 


the conv_textDate is function to converte string date to date format made from Uwe on another post

Code: Select all

 
FUNCTION ValidareData( dFechaIni, dFechaFin )
   IF ( dFechaIni > dFechaFin )
      alert( "La data finale deve essere  maggiore di quella finale " )
      RETURN( .F. )
   ENDIF
   RETURN( .T. )

Re: Problem to Validate a data

Posted: Wed May 22, 2019 12:53 pm
by armando.lagunas
devuelve el valor .t. o .f. desde una variable local

Code: Select all

FUNCTION ValidareData( dFechaIni, dFechaFin )
   IF ( dFechaIni > dFechaFin )
      alert( "La data finale deve essere  maggiore di quella finale " )
      RETURN( .F. )
   ENDIF
   RETURN( .T. )   <---- aqui el problema
 
solución:

Code: Select all

FUNCTION ValidareData( dFechaIni, dFechaFin )
   LOCAL lValid := .T.

   IF ( dFechaIni > dFechaFin )
      alert( "La data finale deve essere  maggiore di quella finale " )
      lValid := .F.
   ENDIF
   RETURN  lValid
 

Re: Problem to Validate a data

Posted: Wed May 22, 2019 3:48 pm
by Silvio.Falconi
thanks

Re: Problem to Validate a data

Posted: Thu May 23, 2019 7:25 am
by Enrico Maria Giordano
[quote="armando.lagunas"]

Code: Select all

   RETURN( .T. )   <---- aqui el problema
No problem here. It's a perfectly legal code.

EMG