Reputation: 28865
I'd like to get the creator and the last modifier of Lotus Domino document. How could I do this?
I've found the Authors
property, which is a Vector
but its ordering isn't defined in the documentation. Can I rely on that that the first element is the creator and the last one is the last modifier?
Upvotes: 2
Views: 8141
Reputation: 163
The safest solution is to set up a 'computed when composed' type field on the design that's set to the current user when the doc is created, and another one that'd hold the last modifier name (something like @SetField("LastUpdatedby";@UserName)
in the QuerySave
event).
In your case, if you just want to gather data from an existing application and there is no manually added field you could use, there will be a few facts to take into consideration:
1.) the $UpdatedBy
item and the Authors property are the same: using the Authors property from Lotusscript will return an array gathered from the $Updatedby
item.
2.) the $UpdatedBy
item can not be manipulated = from this aspect it would be safe to use it
3.) Assuming that you've got the whole history there*, you'll get the creator with a formula like @Subset($Updatedby;1)
or Cstr(updatedbyarray(Lbound(updatedbyarray)))
in lotusscript
4.) You'll always get the last modifier by looking at the last entry in the $Updatedby
array using @Subset($Updatedby;-1)
or Cstr(array(Ubound(array)))
.
5*.) There is a possibility that your DB has a limitation in place for the $Updatedby
entries, as these can be quite space consuming (DB level settings, last tab, Limit entries in $UpdatedBy
fields). Once you hit this limit Notes will start deleting the old entries when there is a new one to be added, and querying the first member of the array won't give you the creator anymore.
6.) Due to the possibility that you won't find the creator in the $Updatedby
array, you should protect your code with something like this:
If Ubound(var)+1 <> db.LimitUpdatedBy Then
'You are safe
Else
Msgbox "Ouch!"
End If
If it's safe, you go ahead and use the $Updatedby
item to do your calculation.
By the way, using our (Ytria) scanEZ product you'll be able to gather these values for all docs in your database without any coding. Few simple formulas, and you've got a full report ready to export to DXL or CSV.
Upvotes: 5
Reputation: 384
Try to use $UpdatedBy
field directly. (I think Authors
property also uses it.) In this field all updaters are stored in chronological order: originator -- first, last modified -- last.
It can show you wrong data if the option "Limit entries in $UpdatedBy
fields" is set in database properties: when it reaches the limit it deletes first entry in $UpdatedBy
, so you couldn't be known about document creator.
Upvotes: 3