|
|
|
|
|
|
|
|
|
|
|
|
|
|
PROGRAMMING POWER
A reusable agent to change field values on documents
By Dan Velasco
I was creating a new database in R5 recently and came across a problem I often encounter. I had several categorized documents that I wanted to change the "CategoryName" field of. Now, in the past, what I have done is to write an agent to change the value of the specific field I wanted to change. I've been through this before, however, and I knew that as soon as I made that change I would find another field I wanted to change as well. Therefore, I'd be right back at square one, writing another agent to change a different specific field's value.
Well, I knew there had to be a better way, and after a lot of coding I've found one. My goal was this: create a single agent, that could be used in multiple views, that would allow a user to change the values of fields on multiple documents they'd selected in a view. I'm happy to say that I have achieved my goal, and that is what I'm here to share with you today.
Overview of how it works The following code is designed to work in Notes/Domino R5 and will not work as-is in Notes/Domino R4.x. It's also designed to work in a view containing similar documents, either created with the same form and/or containing the same fields. The basic structure of how the agent works is described in the next few paragraphs.
The user selects documents that have a field they want to change the value of. A dialog box asks the user to pick the name of the field they want to change, as shown in Figure A;
FIGURE A
 
The list of fields to change is obtained from the first selected document. Roll over picture for a larger image.
A dialog box asks the user to enter the new value of the field, with the old value given as the default, as shown in Figure B.
FIGURE B
 
The old value is given as the default in case the change you want to make is slight. Roll over picture for a larger image.
A confirmation screen prompts the user to make sure they want to make this change, as shown in Figure C.
FIGURE C
 
The confirmation screen ensures that the user is aware that the change will apply to all selected documents. Roll over picture for a larger image.
The change is made on the documents.
If this will be an agent that end-users will use (rather than just yourself), then you also will want to make sure that the names of the fields are clear enough so that the end-user can figure out which field they want to change the value of. This agent is probably best aimed at developers and advanced publishers that have a basic understanding of how Notes fields work.
Agent basics Since this agent is pretty straightforward and well documented, I'm just going to give you the basics about the agent, how to activate it and the code, letting you play with it as you like. Think of this as kind of a DominoPower tip on steroids. Table A gives you an overview of the agent.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.
The many included activities and demos will make you a pro! Expert instructor help is a click away.
Click here to try a FREE demo course!! |
-- Advertisement --
Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.
Register by April 10 to save $200. |
|
|
|
|
|
|
|
|
|
|