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
Error on search a record on dbf with tdatabase
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
- Silvio.Falconi
- Posts: 7170
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 3 times
Re: Error on search a record on dbf with tdatabase
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
Last edited by Silvio.Falconi on Sat Aug 14, 2021 8:19 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Error on search a record on dbf with tdatabase
Silvio,
Great.
Did you understand my explanation about how to handle shortening a reservation?
Great.
Did you understand my explanation about how to handle shortening a reservation?
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
- Silvio.Falconi
- Posts: 7170
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 3 times
Re: Error on search a record on dbf with tdatabase
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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com