Script: Conditionally create populated doc in another database
Posted on 2001-06-26
I have two databases that track the progress of two different processes.
One database tracks the status of design documents. In that database, there are fields where people can put their names to automatically receive updates every time the document changes. These fields are broken down by programmer, GUI developer, documentation, etc.
The other database is used between the programmers and the GUI staff so the programmers can notify the GUI developers when they finish with the programming, so the GUI staff can begin.
The first database includes an agent that queries the user for a name, then passes that name (by environment variable) to another agent that adds that name to the Programmer field for every selected record. (Similar agents exist for the other departments.)
I'd like for the add-a-programmer agent to check to see if a GUI developer has already been assigned to the record and, if one has, create a new record in the second database, assigned to the programmer who was just added to the record in the first database.
As it stands, the add-a-programmer agent looks like this:
========= BEGIN CODE ==========
NewName := @Environment("PassedName");
OldList := @Implode(Programmer; "|");
NewText := @If(OldList = ""; NewName; OldList + "|" + NewName);
NewList := @Explode(NewText; "|");
FIELD Programmer := @Unique(NewList);
FIELD ProgrammerDisplay := @Unique(@Name([CN]; NewList));
FIELD LastEditor := @UserName
========== END CODE ==========
The record in the second database, which I would like to compose, would use the Release and Component fields from the record in the first database. (It is a much simpler form.)
What would the script to implement this look like?