|
|
|
|
|
|
|
|
|
|
A flexible approach to keeping a history of recent edits (continued)
Having stored the necessary information about the initial save, we now come to the four list fields that track all subsequent saves: fEHNums, fEHEditors, fEHDates, and fEHDescriptions. They all use essentially the same code, so if you understand one, you should understand them all. They're all multi-valued (or "list") fields that display each value on a separate line. This is very important because the "nth" revision number always corresponds to the nth editor, the nth edit date, and the nth description. In order to preserve and display this relationship, all four fields must have the same number of values and line up exactly. The table columns must also be wide enough to display every list value on a single line, since wrapping would throw off the alignment.
This can be a little tricky in a tool that has flexible settings governing the addition and replacement of "rows." So, to help keep the design simple and synchronized, the fdEHIntervalControl field first figures out whether the new row of values should replace the last row or be appended after it. That is, if this is the first or second save or the current editor is different than the last editor, the field returns "Append". Otherwise, it compares the time since the last edit against fEHInterval. If the interval has not been exceeded, it returns "Replace." Otherwise, it returns "Append".
Note: I use the term "append" backward throughout this article because the Editor History is displayed in reverse order. When "appending" a new value to each list field, I'm really inserting it at the beginning of the list.
n := @Elements (fEHDates);
@If(
n = 0;
@Return("Append");
""
);
DEFAULT fEHInterval := 0;
origtime := @If(
n = 1;
fEHCreated;
@Subset( @Subset( fEHDates; 2); -1)
);
newtime := @Adjust( origtime ; 0; 0; 0; 0; 0; fEHInterval);
val := @If(
@Now > newtime;
"Append";
@Name([CN]; @UserName) != @Subset(fEHEditors; 1) ;
"Append";
"Replace"
);
@If( @IsError (val); "Append"; val)
|
After fdEHIntervalControl makes the Append/Replace decision, the list fields themselves have two remaining tasks. They must actually append or replace with the new value, and they must limit the sliding window to the specified number of rows.
The first part of each list field's formula is specific to the specific field. It gets a handle on the existing list and its size and then determines what the new value should be. For example, the formula in fEHNums starts out by incrementing the sequence number from the previous save:
list := fEHNums;
n := @Elements(list);
newval := @If(
n<1;
1;
@Subset(list; 1) + 1
);
ValIfError := 1;
|
[ Prev | Next ]
|
|
|
|
|
|
-- Advertisement --
AUTOMATE LOTUS NOTES USER ID MANAGEMENT
ID Manager 4.5 from HELP Software provides a new level of automaton for managing Lotus Notes IDs. ID Manager lets Lotus Notes administrators get out of the business of creating and managing user IDs. Use our ROI calculator to see how quickly ID Manager will pay for itself.
Learn more about HELP Software products |
-- Advertisement --
SECURTRAC - MONITOR AND CONTROL YOUR DOMINO ENVIRONMENT
When it comes to your business, how do you ensure compliance with SOX, HIPAA or other industry driven regulations? Use SecurTrac to monitor and audit the life cycle of all objects in your Domino environment.
- Database Monitor
- Mail Monitor
- Domino Directory Monitor
- Notes.ini File Monitor
- Intrusion Detection Monitor
Click here for details and a free evaluation copy. |
|
|
|
|
|
|