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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating for no. of days to wait (like project scheduler)

Status
Not open for further replies.

gem28

Instructor
Nov 5, 2001
64
PH
Hi!
I have a view categorized by room number. The first user to reserve a room becomes first in the list and it stays there for 7 days (until due date) or until the user has confirmed the room reservation. Those who reserve the same room after him becomes part of the wait list.

I need to get the number of days each person has to wait for until they are first in the list. Much like project scheduling.

sample lotus script is very much appreciated.

code snippet:
Code:
Set dview = db.GetView("($AllDocsView)")
	dkey = uidoc.FieldGetText("RefCode")
	Set ddc = dview.GetAllDocumentsByKey(dkey)
	Set ddoc = ddc.GetFirstDocument
	nwait = 0
	Do While Not (ddoc Is Nothing)	
		Set bkDate = New NotesDateTime( Today)		
		Set startDate = New NotesDateTime( ddoc.dueDate(0) )
		duration = Abs(startDate.TimeDifference(bkDate)/86400) - 1		
		dDate = duration + 7 + nwait
		nwait = nwait + duration
	Loop

I am so stumped with this one. Please help.
Thanks so much and God bless!

Tine
 
Why not calculate this directly in a view column? You have the field 'dueDate' and you can use @Today as comparison...

In e.g. something like this (Field 'Confirmed' assumed to hold a confirmation flag):

@If(Confirmed = "0" & dueDate > @Today; @Integer(@Date(dueDate) - @Date(@Today)) / 86400) ; "")

Use @Round if you want to display fractions instead...


Brgds,

TrooDOS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top