outra9e
7th March 2003, 15:35
Guys
I have written a function and basically it checks to see a room is already being used between 2 dates.
I have got it to work by using just a single date, but I want it to actually look for whether there are records between the start date field and the end date field.
Here is the function...
****************************************
function check.room.available()
{
select tssma931.roomn
where tssma931.roomn = :tssma931.roomn and tssma931.stdt = :tssma931.stdt or tssma931.endt = :tssma931.stdt
selectdo
message("Room Unavailable, please choose another room")
input.again()
endselect
}
*******************************************
roomn = the room nunber
stdt = start date
endt = end date
So basically someone picks the room number and enters a start and end date. The function looks for entries where that room number is booked for a date range that conflicts with the range just entered.
I tried using ...
********************************************
where tssma931.roomn = :tssma931.roomn and tssma931.stdt in :tssma931.stdt to tssma931.endt or tssma931.endt in tssma931.stdt to :tssma931.endt
********************************************
This failed as Baan did not understand "in" or "to".
Does anyone have any ideas?
Cheers
I have written a function and basically it checks to see a room is already being used between 2 dates.
I have got it to work by using just a single date, but I want it to actually look for whether there are records between the start date field and the end date field.
Here is the function...
****************************************
function check.room.available()
{
select tssma931.roomn
where tssma931.roomn = :tssma931.roomn and tssma931.stdt = :tssma931.stdt or tssma931.endt = :tssma931.stdt
selectdo
message("Room Unavailable, please choose another room")
input.again()
endselect
}
*******************************************
roomn = the room nunber
stdt = start date
endt = end date
So basically someone picks the room number and enters a start and end date. The function looks for entries where that room number is booked for a date range that conflicts with the range just entered.
I tried using ...
********************************************
where tssma931.roomn = :tssma931.roomn and tssma931.stdt in :tssma931.stdt to tssma931.endt or tssma931.endt in tssma931.stdt to :tssma931.endt
********************************************
This failed as Baan did not understand "in" or "to".
Does anyone have any ideas?
Cheers