Domino 9 und frühere Versionen > Entwicklung

DocumentCollection sortieren nach Datum

<< < (2/6) > >>

Semeaphoros:
Bernhard:
Na, immerhin hast Du mich erwischt, hab das auch nicht gemerkt, ich hab ja nur drauf getriggert, dass AllDocuments normalerweise nicht sortiert ist, aber das gibts eh nur in der DB, und da ist klar, dass sie unsortiert daherkommt.

Andreas:
Also die NotesViewEntryCollection brauche ich auch selten, ganz einfach, weil ich programmatisch eh in der Regel auf entsprechende, verborgend Views zugreife, und da lässt sich gut durch den View durchschlaufen (wie ich das laut Bernhard sagen würde :-), weil da Kategorien fast nie Sinn machen. Hab aber sonst eigentlich nix negatives gehört bisher. Das mit den Kategorien ist nicht wirklich soo kritisch, weil das Ding doch eigentlich Properties besitzt, die einem das ermöglichen sollten:

IsCategory
IsConflict
IsDocument
IsTotal
IsValid

Allerdings gebe ich Dir recht, dass das Arbeiten mit einem derart "schillernden" Objekt Unübersichtlichkeit impliziert

Glombi:
Hab hier was aus der KBase:

The documents contained within a NotesDocumentCollection object are sorted by the created date.  By design, the sort order of the view or folder the documents reside within is ignored.

Domino Designer 5.0 includes two new classes that enable you to access documents in the order they appear within a view:  The NotesViewEntryCollection class and the NotesViewEntry class.  The NotesView class also includes  additional methods and properties that allow you to create object handles to these new classes.

In the following example,  the new AllEntries property of the NotesView class is used to get a handle to all the documents in the view "Test View".   You can then loop through these documents using the NotesViewEntryCollection class' GetNthEntry method.

Sample Script:

   Dim session As New notessession
   Dim db As notesdatabase
   Dim view As notesview   
   Dim viewcol As notesviewentrycollection
   Dim viewentry As notesviewentry
   Dim doc As notesdocument
   
   Set db=session.currentdatabase
   Set view=db.getview("Test View")
   Set viewcol=view.allentries
   
   For i = 1 To viewcol.count    
      Set viewentry=viewcol.getnthentry(i)
      Set doc=viewentry.document
      Messagebox doc.created
   Next


Wie gesagt, wenn man eine kat. View hat, gibt es ein Fehler "Dokument nicht länger in der Collection" oder sowas in der Art. Also: NIEMALS kategorisieren.

Wegen der Performacen würde ich das getnthentry(i) nicht machen, sondern wie es sich gehört mit
...firstentry und ...nextentry.


Andreas

Semeaphoros:
Sieh mal einer an, danke Andreas.

Das war doch etwa das, was ich von Anfang an gesagt habe. Danke für den Beleg hier. Das macht ja eigentlich alles klar.

Gruss, Jens

robertpp:
Das Problem ist:
Ich fülle mein dc mit einem search befehl!

   Set dc = db.Search("@Adjust(@Today;0;0;3;0;0;0) => @Date(Termin) & Entscheid != ""erledigt VA""", Nothing, 0)

Was mach ich jetzt?

robert

Semeaphoros:
Genau das, was Bernhard gesagt hat unter Berücksichtigung meiner und Andreas' Ergänzungen:

Einen versteckten View (Namen in Klammer gesetzt) anstelle des Search

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln