Like simple actions, LotusScript can be used to manage and perform actions in a database. However, LotusScript offers greater flexibility to create more robust agents. This section illustrates how to modify all documents in a database where a field contains a specific value.
A.16.1 |
For this example, LotusScript is used to iterate through database documents in a specific view and compare field values. When a match is found, the new value is assigned to the field, and the document is saved. The looping then continues with the next document in the list.
This example could be used to modify field values for select documents in a database view. Lets say, for example, that a team member has recently transferred to a new department. Using this sample, you could reassign all documents from one person to another person.
To implement this solution, complete the following steps.
Note
Performance for this agent will be affected by a variety of factorstotal documents in the database, total fields in the document, runtime location (server versus local), and so on. If performance becomes an issue, consider replacing If doc.FIELD(0) = "Value1" with the statement If doc.GetItemValue ("FIELD")(0) = "Value1". The GetItemValue method is more efficient and will improve overall agent performance for large databases.