0

「承認者」データベースに承認者というフォームがあります。

フォームには、 OfficeGroupという 2 つの編集可能なテキスト フィールドがあります。また、ダイアログ リスト フィールドSuperior1もあります。

上司1ダイアログ リスト フィールドには、オフィスとグループに基づいてフィルター処理されたスタッフの詳細が表示されます。

承認者フォームからの場合office = TSP & group = HR、別のデータベース「TSP_Staff」の「スタッフ情報」ビューを使用して、これらのフィールド「グループ」と「オフィス」に基づいてスタッフをフィルターし、super1 に表示します

しかし、それは私のためにフィルタリングされていません。:(

私はこの技術に慣れていないので、混乱しており、これを手伝ってくれる人がいません。これは私が使用したスクリプトです:

Superior1 フィールドの場合:

Sub Entering(Source As Field)
    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim uidoc As NotesUIDocument
    Dim doc As Notesdocument
    Dim work As  New NotesUIWorkspace
    Dim workspace As  New NotesUIWorkspace
    Dim sname As String
    Dim consr As String
    Dim cview As notesview

    Set db = s.CurrentDatabase
    Set uidoc = work.CurrentDocument
    Set uidocs = workspace.currentdocument  
    Set cview = db.getview("(Application)")

    'etype = uidoc.FieldGetText("Office") 
    'ftype = uidoc.FieldGetText("Group") 

    etype = "TSP"
    ftype = "TSP1-G"

    If(etype <> "" And ftype <> "")  Then
        Call filter  
    End If

    Set view = db.getview("(x_search_staff)")
    Set doc = view.GetDocumentByKey (uidoc.fieldgettext("Superior1"),True)

    If doc Is Nothing Then
        Msgbox "There is no previous transaction please select new trasaction.", 16, "Information"
        Call uidoc.FieldClear("Superior1")
        Call uidoc.gotofield ("Group")
        Call uidoc.gotofield ("Office")
        continue = False
        Exit Sub
    End If

    Call uidoc.Refresh 
End Sub

スクリプト ライブラリから ...

Sub filter
    Dim s As New notessession
    Dim w As New notesuiworkspace
    Dim uidoc As notesuidocument
    Dim doc As notesdocument, newdoc As notesdocument, d As notesdocument, dd As notesdocument
    Dim doc1 As NotesDocument, newdoc1 As NotesDocument
    Dim dc As notesdocumentcollection
    Dim bc As notesdocumentcollection
    Dim view As notesview, v As notesview
    Dim db As notesdatabase
    Dim nextdoc As NotesDocument
    Dim cview As notesview
    Dim cnview As NotesView
    Dim get_db As New notesdatabase(gsserver2, gspath2 & "Master\TSP_Staff.nsf")

    Set db = s.currentdatabase

    Set view = get_db.getview("(Staff Info)")
    Set cview = db.getview("(x_search_staff)")
    Set cnview = db.getview("(x_superior)")
    Set uidoc=w.CurrentDocument 

    'To delet searched previous datas from form2 ----------------------------------------
    Print "Please wait ..."

    key = "Approver2"
    Set v = db.getview("(x_delete_2)")
    Set dc = v.GetAlldocumentsByKey(key,True)
    'Set bc = v.GetAlldocumentsByKey(key,True)

    'Call bc.RemoveAll(True)
    Call dc.RemoveAll(True)
    Call cview.Refresh

    Call view.Refresh
    Call cnview.Refresh
    Call v.Refresh

    'To start searching process based on Superior1 --------------------------------------

    'f1= uidoc.FieldGetText("Office") 
    f1= uidoc.FieldGetText("Group") 
    'f1 = "TSP1-G"

    Set dc = view.getalldocumentsbykey(f1, True) 
    'Set bc = view.getalldocumentsbykey(f2, True)

    For b =1 To dc.count
        Set doc = dc.getnthdocument(b)
        Set newdoc = doc.copytodatabase(db)
        'For c =1 To bc.count
        'Set doc1 = bc.getnthdocument(b)
        'Set newdoc1 = doc.copytodatabase(db)


        If doc.form(0) = "Approver" Then
        'If doc1.form(0) = "Approver" Then
            newdoc.form = "Approver2"
            'newdoc1.form = "Approver2"
            'End If 

        End If 
        newdoc.save True, True 
         ' Next
         'newdoc.save True, True
         'Next

        Call w.viewrefresh
        Call cview.Refresh
        Call v.Refresh
        Call cnview.Refresh
        Call view.Refresh

        Print "Process Completed....."
End Sub

この要件を段階的に実行する別の方法がある場合は...または...エラーがないかスクリプトを確認してください...助けていただければ幸いです:(今日はこのタスクの期日です...

4

2 に答える 2

0

あなたのコードを理解するのは非常に難しいですが、あなたの意図とfilter関数の一部を理解していれば(コンパイルさえできますか?)、superior1の「useformulaforchoices」セクションですべてのコードをこの@dblookupベースの式に置き換えることできますプロパティ:

@dblookup("":"ReCache";"ServerName":"foo\Master\TSP_Staff.nsf";"(Staff Info)";Group;NameOfInterestingField);

ビューに重複する値が含まれている場合は、その周りに@sortや@uniqueを追加し、一部のグループで空のリストになる場合は、キーワード[FAILSILENT]を追加することできます

さらに簡単な方法は、選択にビューダイアログを使用するようにsuperior1を構成することです。

于 2011-05-09T17:59:54.023 に答える
0

データベースからドキュメントを削除して、ビューに表示されるドキュメントをフィルタリングすることがどれほど賢明かはわかりません:)

私の提案は、最初にコードを適切に投稿することです。これは単純に読めません。

ダイアログ リストにドキュメントのサブセットのみを表示する方法は?

フォームに隠しフィールドを作成します (コードを使用して、リストに表示する値を入力します)。次に、ダイアログ リスト フィールド プロパティの 2 番目のタブで、選択肢オプションを [選択肢に式を使用] に設定し、非表示のフィールド名に設定します。

さらにサポートが必要かどうか尋ねてください...

于 2011-02-28T12:52:11.987 に答える