I have a form where in i have the edit history. I am able to log the actions there. The problem is i want only last 3 edits made, starting with the latest and next two edits. But i am getting all edits with latest edit at the bottom, i want the latest edit at the top of the list and only 2 others(if they exist) to follow. I am using "Source.FieldAppendText " for the edit history.
Can anyone let me know what to do to have the last 3 edits with the latest at top of list and remaining 2 to follow. I have to do this in Lotus Script only.
FieldAppendText will add the new date to the end, as it says, so you can’t really use that.
You’re probably best off creating an array and populating that with the new value as it’s 0 index, then the current first 2 elements of the field next. You’ve then got the last three values which you assign to the field. This is all back-end stuff so do a source.reload afterwards.
That’s the one - 2 points though, both a bit arbitary in this situation where the code is quite short (and a bit pedantic, but it is friday afternoon and I’m in that sort of mood), but relevant nonetheless.
Why use evaluate? Evaulate is quite expensive and slow. Why not just use s.commonusername to get the string? Much quicker.
Redim preserve is also expensive and should be avoided if possible. There’s no need to use the preserve in this example as the array is empty anyway.
Both valid points, I grant you, but the code was cut from a MUCH bigger piece of code and modified here for simplicity. I chose to use the evaluate as in the agent it was cut from it does a lot more than just get the users name, and redim preserve is used because, again, in the agent, the array is not empty.