这些数据基本上有两种方式在你描述的数据模型中联系起来。 如果通过回复文件链接数据,就会与主要的文件结构稍有不同。
给你的开发商显示这一点,他实际上应当能够在守则中插手,使你所谈论的“出勤者”要求得以实现。
有几个问题值得注意。
- I am assuming that all the data you need to manipulate is in one database.
- I am taking your diagram you ve provided literally.
对于主要的文件结构,你需要检查所查阅的文件所用的观点和关键价值。 具体检查“MoveAttendeesKeyBased”子中的这两条线:
Set vwAttendeesByCourseID = db.GetView(“Lkup AllAttendeesByCourseID”)
Set dcAttendees = vwAttendeesbyCourseID.Get AllDocumentsByKey (docCourseFrom.CourseID(0), Real)
The code is designed to look at a field called "CourseID", "Status" and the value of "Wait Listed" for the status value of attendees to be moved.
这两本职能都用了20分钟。
应急文件结构
Sub MoveAttendeesResponseBased(docCourseFrom As notesDocument, docCourseTo As NotesDocument)
%REM
A simple move attendees function if the relationship between courses and attendees is based on
response document hierarchies
%END REM
On Error Goto errHandle
Dim dcAttendees As notesDocumentCollection
Dim docAttendee As notesDocument
Dim iAvailablePlaces As Integer
Dim bMoved As Boolean
If Not (docCourseFrom Is Nothing Or docCourseTo Is Nothing) Then
iAvailablePlaces = docCourseTo.availablePlaces(0)
If 0 < iAvailablePlaces Then
bMoved = False
Set dcAttendees = docCourseFrom.Responses
Set docAttendee = dcAttendees.GetFirstDocument
While Not docAttendee Is Nothing And 0 < iAvailablePlaces
If Ucase(Trim(docAttendee.Status(0)))= "WAIT LISTED" Then
Call docAttendee.MakeResponse(docCourseTo)
If docAttendee.Save(True,True) Then
iAvailablePlaces = iAvailablePlaces - 1
bMoved = True
End If
End If
Set docAttendee = dcAttendees.GetNextDocument(docAttendee)
Wend
If bMoved Then
docCourseTo.availablePlaces = iAvailablePlaces
Call docCourseTo.Save(True,False)
End If
End If
End If
Exit Sub
errHandle:
Messagebox Lsi_info(2) + " - " + Str(Err) + " : " + Error(Err) + ", at line " + Str(Erl)
Exit Sub
End Sub
关键文件结构
Sub MoveAttendeesKeyBased(docCourseFrom As notesDocument, docCourseTo As notesDocument)
%REM
A simple move attendees function if the relationship between courses and attendees uses
(non-response) key based documents
%END REM
On Error Goto errHandle
Dim session As New notesSession
Dim dcAttendees As notesDocumentCollection
Dim docAttendee As notesDocument
Dim iAvailablePlaces As Integer
Dim bMoved As Boolean
a view that lists attendees by Course ID
Dim vwAttendeesByCourseID As notesView
Dim db As notesDatabase
If Not (docCourseFrom Is Nothing Or docCourseTo Is Nothing) Then
iAvailablePlaces = docCourseTo.availablePlaces(0)
If 0 < iAvailablePlaces Then
Set db = session.CurrentDatabase
do a lookup of all attendees based on the CourseFrom document course id
Set vwAttendeesByCourseID = db.GetView(“Lkup AllAttendeesByCourseID”)
this is the collection of all attendees under the CourseFrom document
Set dcAttendees = vwAttendeesbyCourseID.Get AllDocumentsByKey (docCourseFrom.CourseID(0), Real)
bMoved = False
Set docAttendee = dcAttendees.GetFirstDocument
While there are attendee documents to process and there are available places to goto
While Not docAttendee Is Nothing And 0 < iAvailablePlaces
if the attendee s status is "Wait Listed" then move them
If Ucase(Trim(docAttendee.Status(0)))= "WAIT LISTED" Then
Update the course ID for the Attendee
docAttendee.CourseID = docCourseTo.CourseID(0)
If docAttendee.Save(True,True) Then
decrement the available places
iAvailablePlaces = iAvailablePlaces - 1
bMoved = True
End If
End If
Set docAttendee = dcAttendees.GetNextDocument(docAttendee)
Wend
If bMoved Then
available places may be >= 0. Just update the available places so you don t over book the course
docCourseTo.availablePlaces = iAvailablePlaces
Call docCourseTo.Save(True,False)
End If
End If
End If
Exit Sub
errHandle:
Messagebox Lsi_info(2) + " - " + Str(Err) + " : " + Error(Err) + ", at line " + Str(Erl)
Exit Sub
End Sub
重要文件的工作不多,但我认为是一个更好的结构,因为你可以很容易地将文件输入数据库,并从备份、复印件和过去恢复。 如果有答复文件,你可能会有问题,恢复备用贝卡应答文件,使用联合国国际交易日志的母文件,并且如果你因事故而搬走到来,也不可能知道,在没有原始课程信息的情况下,谁会回来,从而导致你回到文件的关键结构。 (千美元) 但这只是我的意见。