Problem with editing

Hi,I just found out an interesting problem in my notes database.

I have a form with a button named “Save” by using the formula:

@PostedCommand([FileSave])

I have another field named “Edit History” to record the latest 10 Editors by using the formula:

@Left(@If(@IsDocBeingSaved; @If(Editor = “”; @Name([CN]; @UserName); @Name([CN]; @UserName) : @If(@Elements(Editor) > 9; @Subset(Editor; 9); Editor)); Editor); 25)

I have another field named “ModifiedOn” to record the latest Edit Time Stamp by using the formula:

@Modified

The problem is that I found out some people edited some document, and the field “ModifiedOn” works fine, it shows the latest editing time; however, the field “EditHistory” didn’t record this latest modification.

People may use “Save” button to save the doc; or press ESC to exit the doc and choose “Yes” when system asks “Do you want to save your change?”.

Do you know where is wrong?

Thanks.

Subject: Problem with editing

Ann,

There are a few things I wouldn’t do here, but I’m not sure that any of them are your problem.

  1. Verify that field is computed

  2. I would change the formula to something like this (code not tested):

tmyName := @Name([CN]; @UserName);

myName := @If(@length(tmyName) > 25; @Left(tmyName; 25) + “…”; tmyName);

nameList := @If(@IsNewDoc; myName; @IsDocBeingSaved; myName : Editor; Editor);

@subset(namelist; 10)

hth,

raphael

Subject: RE: Problem with editing

Thanks, Raphael.

The fields are computed.

I just want to know what kind of operation can cause this results, because when I edited the documents, they are fine, but I do find several persons meet this situation (EditHistory is not updated, but the ModifiedOn works fine).

Any idea?

Subject: RE: Problem with editing

Have you got any actions/agents in your system which allow your users to update documents in the backend? Or even an action/agent which runs a ToolsRefreshAllDocs or ToolsRefreshSelectedDocs command? This would cause the document to be saved, which the @Modified would pick up, but I think that it wouldn’t count as the type of save which the @IsDocBeingSaved formula would pick up on.

Emily.

Subject: Problem with editing

This code saves the last 5 edits, both the name a date/time stamp. The field is text, computed.

REM {ListSize contains the number of document saves that will be shown in the document};

ListSize := 5;

REM {See if the document is being saved. If not, exit without change.};

@If(@IsDocBeingSaved; @True; @Return(SaveHistory));

EditList := SaveHistory;

REM {Document is being saved. Determine the number of the prior save.};

REM {For example, if A is 6, that indicates the document has been saved 6 times and this current save will be the seventh.};

A := @Word(EditList; “-”; 1);

REM {Calculate the current save number, taking into account the number 1-9 are only one character long.};

NEWNUM := @Text(@TextToNumber(“0” + @Word(@Implode(A); " "; 1)) + 1);

REM {Build the new edit line(format the date correctly)};

REM {Notice the second parameter on the @Text function. This seldom used};

REM {parameter allows us to automatically format a date/time argument};

REM {In this case, it strips off the seconds from @Now.};

NEWLINE := NEWNUM + " - " + @Text(@Now; “D0T1”) + " - " + @Name([CN];@UserName);

@Trim(@Subset(NEWLINE : EditList; ListSize))

Subject: RE: Problem with editing

Thanks Tricia.

However, I still want to know what operation can cause that problem.

Please help.

Subject: RE: Problem with editing

I found the problem. It’s because the formula: @modified.

Usage:

@Modified works correctly only in column formulas. When used in computed field or computed-for-display formulas, @Modified returns a value representing the next-to-last time the document was saved. For example, if you modified and saved a document on the mornings of May 5th and 6th, then accessed the document in the afternoon on May 6th, the @Modified computed field would return the May 5th modification date, since the 5th was the next-to-last time the document was saved. This function does not work in mail agent, paste agent, hide-when, section editor, or form formulas.