Type PersonRecord
empName As String * 40
End Type
Type PrintFields
itm As String
End Type
Dim field_N(0) As PrintFields
Sub Initialize
field_N(0).itm="Name"
Dim fileNum As Integer
Dim fileName As String
Dim rec As PersonRecord
'//
Dim PDdb As New NotesDatabase("DominoServer/KazNPU","DB/PD/PD.nsf")
'//
Set s=New NotesSession
Set CurDB = s.CurrentDatabase
Set ws=New NotesUIWorkspace
'//
Dim Col As NotesDocumentCollection
Dim pdoc As notesdocument
Set Col=ws.PickListCollection(PICKLIST_CUSTOM, False, "DominoServer/KazNPU","DB/PD/PD.nsf", "$Faculty", "Выберите фак.", "Выберите фак.")
Set pdoc = Col.GetFirstDocument
faculty = pdoc.Faculty(0)
'//
If(faculty="") Then Exit Sub
'//
fileNum% = Freefile()
fileName$ = "C:\Temp\db_txt\chairs\"+faculty+".txt"
'//
sf={form="Kafedra" & Faculty="}+faculty+{" & name<>""}
'//
Open fileName$ For Random As fileNum% Len = Len(rec)
'//
Set DCol=PDdb.Search(sf, Nothing, 0)
Set TDoc=DCol.GetFirstDocument
Dim i As Integer
i=1
While Not(TDoc Is Nothing)
Set itm=TDoc.GetfirstItem(field_N(0).itm)
t = itm.text
rec.empName$ = t + Chr(13) + Chr(10)
Put #fileNum%, i, rec.empName$
i=i+1
Set TDoc=DCol.GetNextDocument(TDoc)
Wend
'//
Seek fileNum%, 1 ' Rewind file to beginning.
Do While Not Eof(fileNum%)
Get #fileNum%, , rec
Loop
Close fileNum% ' Close the file.
End Sub