|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 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 --
Struggling with exporting Notes data to spreadsheets? No More!
Try IntelliPRINT, The world's leading Reporting, Dashboards, and Analysis solution for Notes & Domino
- Don't spend unproductive time maintaining different versions of the same spreadsheet
- Preserve data integrity and security in multi-user environments
- Create reports in minutes INSIDE Notes
- Get freedom from iterative report requests, deliver self-serve capabilities
Experience Reporting, Dashboards, and Analysis INSIDE Notes.
Try IntelliPRINT NOW! |
|
|
|
|
|
|
|
|
|
|