2

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?

palacsint
  • 28,416
  • 10
  • 82
  • 109
  • Do you want to check only existing documents or change the design to track creator/modificator? – pstr Oct 26 '12 at 08:00
  • @pstr: Just checking existing document. I can' modify the database (I have only read-only access). – palacsint Oct 26 '12 at 08:34
  • Are you sure there's no field value that's already set to the document creator? I would think that if it matters who created it, the designer would put that in a field. – David Navarre Oct 26 '12 at 15:12
  • @DavidNavarre: I'm collecting metadata and statistical information from multiple databases. They probably have that information in custom items but currently it's out of scope to discover internal database structures. – palacsint Oct 26 '12 at 17:38

2 Answers2

5

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.

Alban
  • 1,915
  • 1
  • 14
  • 17
Ben Menesi
  • 163
  • 8
3

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.

palacsint
  • 28,416
  • 10
  • 82
  • 109
pstr
  • 384
  • 1
  • 2
  • 6