Lotus Notes/Lotus Designer

Lotus Script 텍스트 파일을 읽어서 처리하는 로직

지병철 2013. 9. 26. 13:26

Client보기의 버튼에다 넣으시면 됩니다.

 

Sub Click(Source As Button)

    Dim s As New NotesSession

    Dim db As NotesDatabase

    Dim Logdoc As NotesDocument

    Dim filename As String

    Dim view As NotesView

    

    Set db = s.CurrentDatabase

    

    Dim text As String, fileNum As Integer

    Dim index As Long

    

    filename = Inputbox$("입력할 UNID가 저장되어있는 TEXT문서의 경로를 입력하세요.","파일선택", "D:\자료\처리할문서UNID.txt")

    

    If filename = "" Then

        Msgbox "경로를 입력하지 않았거나 취소하였으므로 수행을 취소합니다"

        Exit Sub

    End If

    

    Set view = db.GetView("LogViewBySEQ")

    Set logdoc = view.GetFirstDocument

    

    index = logdoc.SEQ(0)+1

    

    fileNum% = Freefile()

    Open filename For Input As fileNum%

    Do While Not Eof(fileNum%)

        Line Input #fileNum%, text$

        

        If text$ <> "" Then

            Set view = db.GetView("LogViewByUNID")

            Set logdoc = view.GetDocumentByKey(text$)

            

            If logdoc Is Nothing Then

                Set logdoc = New NotesDocument(db)

                logdoc.SEQ = index

                logdoc.Form = "LogForm"

                logdoc.docid = text$

                logdoc.Flag = "New"

                Call logdoc.Save(True,False)

                index = index+1

            End If

        End If

        

    Loop

    Close fileNum%

    

End Sub

'Lotus Notes > Lotus Designer' 카테고리의 다른 글

Lotus Script 로 Collection 이용하기  (0) 2013.11.21
@DbColumn, @DbLookup  (0) 2013.11.21
Lotus Domino ODBC 연결  (0) 2013.11.05
Lotus Script - DB 양식에 쓰기  (0) 2013.09.27
Lotus Script - explode  (0) 2013.09.27