Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

@FindFreeResource ... won't return anything except empty string

Status
Not open for further replies.

xsouldeath

Programmer
Oct 26, 2007
6
0
0
CA
I've found the syntax of the function @FindFreeResource, and I'm trying to get it to return within LotusScript

Description of function
--------------------------------------------------
Syntax
@ Findfreeresource ( key , resource type , start datetime ;
EndDateTime ; capacity ; results )
Parameter
T
Text. If, in canonical form whether you wish to receive from all the
resources of a site (Site) or only in certain categories of results. "CN
=* / O = Berlin" is looking for all the resources of the site "Berlin",
"CN =* / OU = Projector / O = Berlin" only searches the category of
resources "Beamer" the location "Berlin".
Resource Type
Text. "1" is looking for spaces, "2" in resources.
StartDateTime
Time / date. Beginning of the desired reservation.
EndDateTime
Time / date. End of the desired reservation.
Capacity
Sets number at room reservation ( resource-type "1") set the minimum required capacity.

Results
Number Specifies the maximum number of hits, which may return the function.

Return Value

Resource name
Text or text list. The names of the criteria according to resources found in canonical form. If more results displayed as a connected set will, as resources are the preferred whose capacity is closer to the capacity lie.
If no relevant resources found with the criteria it is evaluated to an empty string "back".
---------------------------------------------------

My source code would be the following in an "Agent", which I then call on button click for now... Once I have the name of an available room I can book a meeting with this room I guess...

dim ResNameCheck as Variant
ResNameCheck = Evaluate({@FindFreeResource("CN=*/O=Toronto";"1";"1/17/2011 10:15:00 AM";"1/17/2011 10:45:00 AM";1;30)})

Messagebox ResNameCheck
'Messagebox ResNameCheck(0)
'Messagebox ResNameCheck(1)



the resNameCheck would be used to let you use the Lotus Formula in LotusScript.. the 1st parameter looks in the location Toronto
the 2nd parameter, specifies its a room
the 3rd parameter specifies start time "1/17/2011 10:15:00 AM"
the 4th parameter specifies the end datetime "1/17/2011 10:45:00 AM"
the 5th parameter specifies minimum capacity of 1
the 6th parameter specifies maximum number of results of 30.





Can anyone test this function out and let me know a working syntax?
 
I would suggest that you try to get it working in Formula first. Create a simple agent which does a prompt containing the room name.

Make sure you have the same "O" value as that specified in your room resources.

The reservation time arguments need to be time/date values.
Not sure that the string values you are passing will work.


This worked for me (note - Aussie date format)

tmpStart:=@TextToTime("18/01/2011 10:00:00 AM");
tmpEnd:=@TextToTime("18/01/2011 10:15:00 AM");
tmpRoom:=@FindFreeResource("CN=*/O=Toowoomba Office Complex";"1";tmpStart;tmpEnd;1;30);

@Prompt([OK];"Available Room";tmpRoom)
 
thanks so much for your response ill try it out asap
 
Hey again,

tmpStart:=@TextToTime("18/01/2011 10:00:00 AM");
tmpEnd:=@TextToTime("18/01/2011 10:15:00 AM");
tmpRoom:=@FindFreeResource("CN=*/O=Toronto";"1";tmpStart;tmpEnd;1;30);

@Prompt([OK];"Available Room";tmpRoom)

... That works it shows a messagebox with 1 room...
---------------------------
Available Room
---------------------------
CN=Rio De Janeiro/O=Toronto
---------------------------
OK
---------------------------

However, I've tried an equivalent in LotusScript and it won't return anything but an blank messagebox

Dim ResNameCheck As Variant

Dim tmpStart As notesdatetime
Dim tmpEnd As notesdatetime

Set tmpStart=New notesdatetime("18/01/2011 10:00:00 AM")
Set tmpEnd=New notesdatetime("18/01/2011 10:30:00 AM")
ResNameCheck = Evaluate({@FindFreeResource("CN=*/O=Toronto";"1";tmpStart;tmpEnd;1;30)})


Messagebox Cstr(resnamecheck)
 
I got it working!!

Sub Initialize

Dim tmpStart As Variant
Dim tmpEnd As Variant
Dim ResNameCheck As Variant
tmpStart=Cdat("01/18/2011 10:00:00 AM")
tmpEnd=Cdat("01/18/2011 10:30:00 AM")

ResNameCheck = Evaluate({@FindFreeResource("CN=*/O=Toronto";"1";@TextToTime("18/01/2011 10:00:00 AM");@TextToTime("18/01/2011 10:30:00 AM");1;30)})

Messagebox resnamecheck(0)




End Sub
 
just since this would show up on a Google search for people interested...
it does return multiple rooms :-D


ResNameCheck = Evaluate({@FindFreeResource("CN=*/O=Toronto";"1";@TextToTime("21/01/2011 10:00:00 AM");@TextToTime("21/01/2011 10:30:00 AM");1;30)})
Messagebox Join(resnamecheck,";")

it indeed returns multiple rooms(the last parameter indicates the # of results!)
---------------------------

---------------------------
CN=Tokyo/O=Toronto CN=Bangkok/O=Toronto CN=Casablanca/O=Toronto CN=Moscow/O=Toronto CN=Rio De Janeiro/O=Toronto CN=Istanbul/O=Toronto CN=Library/O=Toronto CN=Las Vegas/O=Toronto
---------------------------
OK
---------------------------


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top