1

Domino の開発者は、ドキュメント間でサブドキュメントを移動することは「技術的に不可能」であると述べています。これは本当ですか?

今年の初めに、彼は次のデータベース ダイアグラムを使用したコース登録システムを作成してくれました。

データベース図

ここで、ウェイティング リストに登録されている登録者をフル トレーニング セッションからそうでないセッションに移動する方法を彼に尋ねました。彼はそれは不可能だと言いました。彼は、Domino は参加者をあるセッションから別のセッションに移動できないため、順番待ちリストのレコードを再入力 (手動で再作成、コピー、貼り付け) する必要があると述べました。

ウェイティング リストには 1000 人以上の参加者がいます。

彼は正しいですか?これは本当ですか?解決を願っています。

4

4 に答える 4

2

その方法は、ドキュメントがリンクされている方法によって異なります。しかし、どのような場合でも、コード (formula/lotusscript/java) を使用してドキュメントを再リンクできるはずです。

Lotus デザイナーのヘルプには、アプリケーション開発に関する多くの情報が含まれています。もう 1 つのリソースは、IBM developerworks です。

Lotus 関連のブログが多数あります

Lotus Designer ヘルプから: MakeResponse: ある文書を別の文書への応答にします。2 つのドキュメントは同じデータベースにある必要があります。

Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim docA As NotesDocument
Dim docB As NotesDocument
Set db = session.CurrentDatabase
Set view = db.GetView( "All documents" )
Set docA = view.GetFirstDocument
Set docB = view.GetNextDocument( docA )
Call docB.MakeResponse( docA )
docB.Form = "Response"
Call docB.Save( True, True )
于 2011-10-06T07:38:34.450 に答える
1

ドキュメントをリンクする方法は 2 つあります。

キーを使用する論理リンクしかない場合は、キー項目を調整するだけで済みます。「物理的な」文書と応答のリンクがあれば、そのリンクを簡単に壊して再作成できます。LotusScript には、任意の文書を新しい親に添付する NotesDocument.MakeResponse メソッドがあります。両方の方法を使用する場合、もちろん冗長ですが、一部のリンクを回復する必要がある場合は実用的であり、両方の変更を行う必要があります。通常、一部のキー フィールドは親から子に繰り返されます

テスト目的で、これを試すことができます: - 別の場所にハングアップする応答ドキュメントを選択します - Ctrl-X - 新しい親ドキュメントを選択します - Ctrl-V

キー フィールドは自動的に更新されないため、テスト データベースでこれを行います。ところで、このような応答ドキュメントを貼り付けた後、キーを修復するコードを書くことができます。

于 2011-10-06T09:26:32.093 に答える
0

既存のドキュメントを保持したい場合は、プログラムでコピー/複製できます。copyAllItems メソッドを使用すると非常に簡単です。

ここで Domino ヘルプ (例を含む) を参照してください

notesView オブジェクト (getFirstDocument() / getNextDocument() メソッド) でドキュメントを反復し、notesdocument.responses メソッドで応答を反復することができます...

それは可能です。Domino は柔軟です :-)

于 2011-10-06T19:03:46.697 に答える
0

基本的に、このデータが記述したデータ モデルにリンクされる方法は 2 つあります。データが応答ドキュメント階層を介してリンクされている場合、キー ベースのドキュメント構造とは少し異なります。

これを開発者に見せれば、開発者は文字通りコードをプラグインして、あなたが話している「出席者の移動」要件を有効にすることができるはずです。

注意すべき点がいくつかあります。

  • 操作する必要があるすべてのデータが 1 つのデータベースにあると想定しています。
  • 私はあなたが提供したあなたの図を文字通り取っています。
  • キー ベースのドキュメント構造については、出席者ドキュメントの検索に使用されるビューとキー値を確認する必要があります。具体的には、「MoveAttendeesKeyBased」サブの次の 2 行を確認してください。

    Set vwAttendeesByCourseID = db.GetView("(LkupAllAttendeesByCourseID)")

    dcAttendees = vwAttendeesbyCourseID.GetAllDocumentsByKey(docCourseFrom.CourseID(0), True) を設定します。

  • このコードは、"CourseID"、"Status" と呼ばれるフィールド、および移動する出席者のステータス値の "Wait Listed" の値を調べるように設計されています。

  • この関数の両方のバージョンを記述するのに約 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("(LkupAllAttendeesByCourseID)")
            ' this is the collection of all attendees under the CourseFrom document
            Set dcAttendees = vwAttendeesbyCourseID.GetAllDocumentsByKey(docCourseFrom.CourseID(0), True)
            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

キーベースのドキュメントは少し手間がかかりますが、データベース内のドキュメントを簡単に移動したり、バックアップから復元したり、コピーして貼り付けたりできるため、より良い構造だと思います. 応答文書では、バックアップの復元に問題が発生する可能性があります。これは、応答文書が親文書の UNID を使用して自分自身を関連付けるためです。また、誤って出席者を移動した場合、元のコース情報がないと、出席者をどのコースに戻すかを知ることができません。 、したがって、ドキュメントのキーベースの構造に戻ります(ただし、それは私の意見です).....

于 2011-10-07T03:24:40.793 に答える