Don’t know where to start.
I have a db of approved parts. Each part can have multiple versions starting with 1 and going up. I need to show only the latest versions for each part.
I am not sure if I need a formula within a field to flag it as the latest version? If so can you point me in the correct direction.
Is there something that can be done in the view selection? I was thinking I have to do something with a DBColumn lookup in which case this is not possible.
Update: I have added a field my form for a flag. I have placed in the following:
List := @DbLookup(“”:“”;“”:“”;“Part File Part Form”;Num;6;[Failsilent]);
@Max(List)
If I just use the DbLookup then I get the list of version numbers. When I place @Max in the formula, it shows nothing. How can I display the the highest number of the list?
Thanks
Teri
Subject: RE: Select last version to show in view – Need to find highest number of list
To answer your specific question first: your version number is not a number, it is text, and your lookup results probably contain some null entries, which are treated as the maximum. Even if there were no null values, the maximum value of a text list is the last value alphabetically, and while 9 < 10, “9” > “10”. So that won’t work.
But there’s a larger problem. A view selection formula can only decide whether the document belongs in the view based on the data in that one document. To make an old version vanish from the view, you have to alter the old document somehow – not just the new document. Whatever formula you use in a computed field, it’s only evaluated when the document is edited and only affects a view when the edited document is saved. So all you really know from this value is whether the document is the latest version at the time it was last edited, which is probably true for all the documents.
So what you have to do, is have some code that executes when a new version is saved, that will find the old version and flag it as old. This might be done with a server agent that runs when documents are modified (in which case there would be some latency during which both old and new version appear in the view) or with Postsave code on the form (in which case there’s no latency but the user must have access to edit the old document).
You might also look at the built-in versioning feature of Notes, which lets you edit one document and save off old versions automatically as you go (you can control whether a new version is created with field formulas). You can select that the old versions be responses, which makes it simple to exclude them from the view.
Subject: RE: Select last version to show in view – Need to find highest number of list
Thanks Andre,
I figured the answer was not going to be that simple.
I will look at the server agent. Placing code in the Postsave will not work since the old versions are locked down and the approver would not have editing rights to the old versions.
I will also look at the versioning feature that you mentioned. I am not sure if the db owner will go for this type of re-design of his db though, until I fully understand any and all ramifications.
After posting this, I revisted the people requesting the view and found that the data was to be used primarily to be exported to an Access database. I was able to show them how to query the data to show only the most current version of the approved docs. However, I know that at sometime in the future someone will want to see the data within the LN database, so I will continue to look at two of the items you suggested.
Teri