View selection formula

I am attempting to do the following:

I have a view will documents having a ref number, category and date created.

Now there are multiple documents with same ref number and I want to display only the latest document in the view for each ref number. What should be the section formula for the View??

Subject: View selection formula

The view selection formula will only look at each document in isolation. You cannot include or exclude documents based on anything in other documents.

Thus, your database needs to set a flag in those documents you need to show in the view. So as each “Latest” document is saved, you need to set it’s flag, and turn off the flag in the prior document.

Subject: RE: View selection formula

its flag

Subject: RE: View selection formula

Your right !

(Yes, I know … it was deliberate)

Subject: RE: View selection formula

I also thought so :)still may be there is a way ?? No :frowning:

Subject: RE: View selection formula

There is not a way using only a view selection formula. As Graham said, you would have to have a process to set a field in a document to indicate whether that document is the latest in its group. Then you can use that field in your view selection formula.

Another way is to store your database in NSFDB2 format, create DAVs of the data that you would use to make the selection, then create a QV with an SQL selection to pull in the documents you want. This is, however, probably more work overall, is likely to be slow, and only works when the replica is on a DB2-enabled server – not a local replica, for instance.

Or, you can just let all the documents appear in the view, but categorize and sort the view so that the document you want is the first in its category. That at least makes it easy to find.