- 27.08.2008
- 8 002
- 610
и вам нужен порядок как во вьюшке а не по порядку добавления доков в БД (вышеозначенная ф-ция выдаст именно в нем)как часто вы оказываетесь в ситуации, когда вотСсылка скрыта от гостей..
небольшой ПОК(
Ссылка скрыта от гостей
)<div class="sp-wrap"><div class="sp-head-wrap"><div class="sp-head folded clickable">"LS"</div></div><div class="sp-body"><div class="sp-content">
Код:
%REM
*--------------------------------------------
Function EnumDCbyView
Description: расставляет документы по порядку следования во вью
у доков находим $REF и по нему группируем
%END REM
Function Enum4ParentByView(NDC As NotesDocumentCollection, view As NotesView) As NotesDocumentCollection
Dim routineName As String
routineName="EnumDCbyView"
On Error GoTo ErrH
'your code here
Dim res As NotesDocumentCollection:Set res=db.CreateDocumentCollection()
Dim lstByParent List As Variant, lstNavParent List As NotesViewNavigator
Dim punid As String, doc As NotesDocument
Set doc=NDC.Getfirstdocument():punid=doc.Parentdocumentunid
Do While Not doc Is Nothing
Dim tmp As String:tmp=doc.Parentdocumentunid
Dim tmpdoc As NotesDocument, cnt As Long
Print {unid:} &doc.Universalid &{;parent:} &tmp
If Len(tmp)<1 Then tmp=doc.Universalid
Dim entry As NotesViewEntry
If Not IsElement(lstByParent(tmp)) Then
Set tmpdoc=db.Getdocumentbyunid(tmp)
Dim nav As NotesViewNavigator
Set nav=view.Createviewnav()
Set entry=nav.GetEntry(tmpdoc)
Print {Pos:} &entry.Getposition({.})
'Set tmpdoc=view.Getdocumentbykey(tmpdoc.Getitemvalue(keyfld), true)
Set lstNavParent(tmp)=view.Createviewnavfromdescendants(entry)
cnt=lstNavParent(tmp).Count
'создаем разреженый массив
Dim arr() As NotesDocument:ReDim arr(cnt) As NotesDocument
Set arr(0)=entry.Document
lstByParent(tmp)=arr
End If
If Not tmp=doc.Universalid then
Set entry=lstNavParent(tmp).GetEntry(doc)
Print {Pos:} &entry.Getposition({.})
Dim pos As Integer:pos=CInt(StrRight(entry.Getposition({.}),{.}))
Dim v:v=lstByParent(tmp)
Set v(pos)=doc
End If
Set doc=NDC.Getnextdocument(doc)
Loop
ForAll chlds In lstByParent
ForAll chld In chlds
If Not chld Is Nothing Then Call res.Adddocument(chld)
End ForAll
End ForAll
Set Enum4ParentByView=res
Quit:
Exit Function
ErrH:
Error Err, RaiseError
Resume Quit
End Function