Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting docs in a view 1

Status
Not open for further replies.

Daviboysmith

Technical User
Jul 9, 2002
24
CA
Hi All,

I have a categorized view. What I want to do is enable the user to select a category and be able to perform an action on all the docs under this category rather than have the user select all the documents under this category individually. Can please someone guide me to how this can be accomplished either by formula or lotus script. I appreciate all your help in advance.

Thanks,
 
Formula will not cut it here, you need script.
For the rest, the job is simple : write an agent that retrieves the different categories of the view, presents the selection box, and then gathers a notesdocumentcollection of the chosen category. All that is left is doing the action on each document.

Here is some code to get you started :
Code:
dim session as new notessession
dim ws as new notesuiworkspace
dim db as database
dim view as notesview
dim coll as notesdocumentcollection
dim doc as notesdocument
dim olddoc as notesdocument
dim catlist as variant
dim chosen as string
dim defchoice as string
const OKCANCELLIST = 4

set db = session.currentdatabase
set view = db.getview([i]nameofview[/i])
.
. retrieve category values
.
defchoice = catlist.values(0)
chosen = ws.prompt(OKCANCELLIST,"Category Change","Please choose a category for the operation",defchoice,catlist)
if chosen<>"" then
    set coll=view.getalldocumentsbykey(chosen)
    if coll.count>0 then
        set doc=coll.getfirstdocument
        do while not(doc is nothing)
            .
            . do operation
            .
            set olddoc = doc
            set doc = coll.getnextdocument(olddoc)
            delete olddoc
    end if
end if

Pascal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top