I must filter the Reserva.dbf
local cTipoElemento:="01"
local nElemento:= 5
local dDataIniziale:= ctod("04/07/2021")
local dDataFinale:= ctod("08/07/2021")
and I made this command
oReservations:Exec( < ||
SET FILTER TO AllTrim( FIELD->TYPE ) = AllTrim( cTipoElemento ) .and. FIELD->NUM = nElemento ;
.AND. ( dDataIniziale <= FIELD->CHECK_OUT .AND. dDataFinale >= FIELD->CHECK_IN )
return nil
> )
as you can see on Picture the filter not run ok
If it is good for the type (01) and the number (5) , it is not good for the dates ie if I select dDataIniziale:= ctod("04/07/2021") and dDataFinale:= ctod("08/07/2021")
the records are not in the selected range
but for the date not run ok how I can resolve ?
this is the test
- Code: Select all Expand view
#include "FiveWin.ch"
request dbfcdx
request dbffpt
Function test()
local oReservations
local cTipoElemento:="01"
local nElemento:= 5
local dDataIniziale:= ctod("04/07/2021")
local dDataFinale:= ctod("08/07/2021")
SET DATE ITALIAN
oReservations:= TDatabase():Open( nil, "RESERVA", "DBFCDX", .t. )
oReservations:SetOrder( "room_in" ) //ROOMS_ID + DToS( CHECK_IN )
oReservations:Exec( < ||
SET FILTER TO AllTrim( FIELD->TYPE ) = AllTrim( cTipoElemento ) .and. FIELD->NUM = nElemento ;
.AND. ( dDataIniziale <= FIELD->CHECK_OUT .AND. dDataFinale >= FIELD->CHECK_IN )
return nil
> )
oReservations:gotop()
xbrowser oReservations
return nil
then I tried also with tdata but the function oReservations:Exec( < || make me an error
- Code: Select all Expand view
- Error description: Error BASE/1449 Errore sintattico: &
Args:
[ 1] = C {||}
Stack Calls
===========
Called from: Lib\tdata\TData.prg => TRESERVA:SETFILTER( 523 )
Called from: Source\sistema\PBeach.prg => CHANGE_PLAN( 367 )
Called from: Source\sistema\PBeach.prg => (b)BEACH( 133 )
Called from: .\source\classes\DIALOG.PRG => TFSDI:INITIATE( 864 )
Called from: .\source\classes\DIALOG.PRG => TFSDI:ACTIVATE( 330 )
Called from: Source\sistema\PBeach.prg => BEACH( 133 )
Please SomeOne can help me ?
If I make a test with EmagDbu
- Code: Select all Expand view
- ROOMS_ID="0005" .AND. CTOD("04/07/2021") <= CHECK_OUT .AND. CTOD("08/07/2021") >= CHECK_IN .AND. TYPE ="01"
it run ok