2011-02-28 3 views
0

Approver "Approver"db 형식입니다.필터 프로세스 스크립트 라이브러리

양식에 두 개의 편집 가능한 텍스트 필드가 있습니다. 그룹. 대화 상자 목록 필드가 상위 1입니다.

직원의 세부 정보를 표시해야하는 superior1 대화 목록 필드는 사무실 & 그룹에 따라 필터링 :

승인자 양식에서 office = TSP & group = HR 경우, 다음 필드 그룹 "&"사무실 "을 기반으로 직원을 필터링 shud superior1에서 다른 데이터베이스 "TSP_Staff"과 쇼의 "직원 정보"보기.

그러나 그것이 나를 위해 필터링지고 있지 않습니다. :(

나는이 기술을 처음 사용하기 때문에 혼란스럽고 이것으로 나를 도울 사람이 아무도 없다. 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 

... u는 단계적 와트에서이 요구 사항 temme에 대한 다른 방법을 가지고있는 경우

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 

이것은 내가 사용하는 스크립트입니다 할 일 ... 아니면 ... 오류에 대한 스크립트를 chk ... 희망이 도와주세요 :(오늘이 작업에 대한 기한 ...

답변

0

나는 그것이 문서를 필터링하는 것이 얼마나 영리한가요? do를 삭제하여 뷰에 표시 데이터베이스에서 가져온 글 :

제안 사항은 처음에 코드를 올리는 것입니다. 이것은 단순히 읽을 수 없습니다.

대화 목록에 문서의 하위 집합 만 표시하는 방법은 무엇입니까?

양식에 숨겨진 필드를 만듭니다. 코드를 사용하여 목록에 표시 할 값으로 필드를 채 웁니다. 대화 상자의 필드 속성에서 두 번째 탭 인 "선택 사항 수식 사용"옵션을 설정하고 숨겨진 필드 이름으로 설정하십시오.

더 많은 도움이 필요하면 요청

...

+0

코드 게시 오류로 인해 죄송합니다 ... – user631457

+0

땀이 없습니다. 문제를 해결 했습니까? –

0

귀하의 코드는 따라하기가 매우 어렵습니다,하지만 난 당신의 의도와 filter 기능의 일부를 (그것도 컴파일합니까?) 이해한다면 당신은 모두를 대체 할 수 superior1 속성 섹션 "선택에 사용하는 수식은"이 @dblookup 기반 식 코드 :

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

당신은보기가 중복 값을 포함 할 경우 주위에 @sort 및/또는 @unique을 추가 할하고 있습니다 t를 추가하려고 할 수도 있습니다. 그는 일부 그룹이 빈 목록을 생성해야하는 경우 [FAILSILENT] 키워드를 사용합니다.

더 간단 방법은 use view dialog for choicessuperior1을 구성 할 수 있습니다.