Error on search a record on dbf with tdatabase

Re: Error on search a record on dbf with tdatabase

Postby James Bott » Thu Jul 08, 2021 6:39 pm

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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Error on search a record on dbf with tdatabase

Postby Silvio.Falconi » Thu Jul 08, 2021 6:59 pm

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 view
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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6804
Joined: Thu Oct 18, 2012 7:17 pm

Re: Error on search a record on dbf with tdatabase

Postby James Bott » Thu Jul 08, 2021 7:02 pm

Silvio,

Great.

Did you understand my explanation about how to handle shortening a reservation?
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Error on search a record on dbf with tdatabase

Postby Silvio.Falconi » Thu Jul 22, 2021 8:28 am

nageswaragunupudi wrote:No need to open oSearchDB again. We can check with the main database object itself like this.

Code: Select all  Expand view
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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6804
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: byron.hopp and 22 guests