@Modified in a computed formula; need a workaround

I’ve got some simple computed fields for document history:Created by xx on xx

and

Last Modified by xx on xx.

For last modified, it’s a computed field (LastModified) with the following formula:

@If(@IsDocBeingEdited & @IsDocBeingSaved; @Modified; LastModified).

It works, but it doesn’t return the actual date/time info. Designer Help tells me why:

“@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 …”

So, is there a workaround to this, or a better way to code this?

Subject: @Modified in a computed formula; need a workaround

I just use @Now when the doc is being saved

e.g. @If(@IsDocBeingSaved; @Now; @LastModified)

Can also add the name of the current user in if required…

Pete

Subject: RE: @Modified in a computed formula; need a workaround

I just use the field name too - with now and avoid all the @modifieds possible -

@If( @IsDocBeingSaved; @Now; fieldname)

but that’s because I was burned bad when a Notes server went really screwey and the date was jumping ahead uncontrollably. Once that happened, anything with @LastModified was basing it on the erroneous server date.

It was a nightmare.

Subject: RE: @Modified in a computed formula; need a workaround

DOH! Just realised what I did there! LastModified was intended to be the field name aqnd shouldn’t have had an @ in front of it! Sorry for any confusion caused.

It’s been a long week already and it’s only Monday :frowning:

Subject: RE: @Modified in a computed formula; need a workaround

Thanks all!

I’ve changed it around in my template to use:

@If( @IsDocBeingSaved; @Now; fieldname)

Working great so far in the test environment. Changes should get rolled up into production at the next release.