Reputation: 1660
I have a Notes view that has 2 columns (Name | Due Date). There can be multiple documents with the same name but with a different due date. So the view can look like:
Is there a way I can setup my view to only one document per Name with the soonest due date? So that John Smith would only show once with John Smith | 06/13/2014. In the name column I tried wrapping it with @Unique(Name), but that didn't seem to work.
Thanks for any tips.
Upvotes: 1
Views: 187
Reputation: 30960
No, that is not possible. View's selection formula can only work on document itself. It can't @DbLookup() to check if there is a "sooner" document for current name.
You can categorize the view by first column name and sort second column ascending. Then you will always see the soonest date right below the name.
Another approach is to set a flag "soonest" as an item/field in document. Whenever you save a document you would test if current document gets or looses flag "soonest" for current name and set/delete the flag in related documents. Then you could select only documents with this flag in your view. But, you have to decide if the extra effort is really worth it.
Upvotes: 3