Page 2 of 2
Re: Error on search a record on dbf with tdatabase
Posted: Thu Jul 08, 2021 6:39 pm
by James Bott
Silvio,
What Nages wrote is a version of the IsFree() function mentioned in the psuedo code in my previous message. You still need the rest of the logic in my sample pseudo code.
James
Re: Error on search a record on dbf with tdatabase
Posted: Thu Jul 08, 2021 6:59 pm
by Silvio.Falconi
James Bott wrote:Silvio,
What Nages wrote is a version of the IsFree() function mentioned in the psuedo code in my previous message. You still need the rest of the logic in my sample pseudo code.
James
No James,
I have all that I wanted
Code: Select all | Expand
Function Search_Element(cCamera,dCheck_in,dCheck_out,cTypeRoom,oReserva)
local cSearch := oReserva:ApplyParams( "ROOMS_ID == ? .AND. ALLTRIM(TYPE) == ? .AND. RECNO() != ? .AND. (CHECK_IN > ? .OR. CHECK_OUT < ? )", ;
{ cCamera, ALLTRIM( cTypeRoom ), oReserva:RecNo(), dCheck_out, dCheck_in } )
if oReserva:LookUp( cSearch, nil, { || .T. } ) == .T.
? "room is available"
lFree:=.t.
else
? "room is not availble"
lFree:=.f.
endif
return lFree
when return
lFree:=.f. I enable a button the user press the button and the procedure show the nearly umbrellas as a small section of the beach
I have calculated two places near the occupied umbrella but I could expand this section
the umbrella n. 11
is that occupated ( orange)
the green boxes are elements free
Re: Error on search a record on dbf with tdatabase
Posted: Thu Jul 08, 2021 7:02 pm
by James Bott
Silvio,
Great.
Did you understand my explanation about how to handle shortening a reservation?
Re: Error on search a record on dbf with tdatabase
Posted: Thu Jul 22, 2021 8:28 am
by Silvio.Falconi
nageswaragunupudi wrote:No need to open oSearchDB again. We can check with the main database object itself like this.
Code: Select all | Expand
cSearch := oReserva:ApplyParams( "ROOM_ID == ? .AND. ALLTRIM(TYPE) == ? .AND. RECNO() != ? .AND. (CHECK_IN > ? .OR. CHECK_OUT < ? )", ;
{ cCamera, ALLTRIM( cTypeRoom ), oReserva:RecNo(), dCheckOut, dCheckIn } )
if oReserva:LookUp( cSearch, nil, { || .T. } ) == .T.
? "room is available"
else
? "room is not availble"
endif
Nages,
the first time it works fine, in the following when I change the parameters the ApplyParams function does not perform the search correctly and returns me wrong values