I am trying to to do this…
First column in my view is a categorised sorted column.
Document No. There are documents arranged in descending order of date of creation. Now I need a Lscript Agent to stamp all the documents in the view as Latest=“No” and then stamp the Top most document for each Doc # as Latest = “yes”
Doc 1
Latest
Old 1
Old 2
Old 3
Doc 2
Latest
Old 1
Old 2
Old 3
…
…
Please suggest. thanks
Subject: Urgent pl help!
Use the AllEntries property of notesview to get all the entries in sorted order then go through each one. You can get the created date from the notesdocument Created property.
hth
Adam.
Subject: RE: Urgent pl help!
can you pl send some sample code. thanks
Subject: RE: Urgent pl help!
email me at onworldtour NOSPAM hotmail dot com and I will drop you some over.
Subject: RE: Urgent pl help!
Untested but try this. it goes through the entries in a view and if it finds a category, the next one after that it labels ‘Latest’ then all the ones after that Doc 1…etc.
give it a go… obviously tweaks will be required…
Dim ns As New notessession, db As notesdatabase, vw As notesview, vec As NotesViewEntryCollection, ve As NotesViewEntry
Dim doc As NotesDocument, n As Integer
Set db=ns.CurrentDatabase
Set vw=db.GetView("YourView")
Set vec=vw.AllEntries
Set ve=vec.GetFirstEntry
n=-1
Do Until ve Is Nothing
If Not(ve.IsDocument) Then
n=0
Else
'is the first document after the category so give it the latest stamp...
Set doc=ve.Document
If n=0 Then
doc.WhateverYourFieldNameIs="Latest"
Else
doc.WhateverYourFieldNameIs="Old "+Cstr(n)
End If
n=n+1
Call doc.Save(True,True)
End If
Set ve=vec.GetNextEntry(ve)
Loop
Subject: RE: Urgent pl help!
thanks