Logic put in to a view selection

on a form I have a date field named RequestDate with this has the default value

@If(@IsNewDoc; @Today; RequestDate)

Can I have a view named Current Month - and it will show all documents that fall within the current month?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
Sure, but the refresh-arrow for the view will always be visible.

td:= @Today;
fd:= @Adjust(td; 0; 0; -@Day(td)+1; 0; 0; 0);
ld:= @Adjust(fd; 0; 1; 0; 0; 0; 0);

Select Form="xxx" & fd<=RequestDate & RequestDate<ld
You will get bad performance with such a view, because any current-time based formula in a view causes the whole view to be completely rebuilt every time you use it.  the "triggers" are:

You can get around this by setting the "refresh view at most onece every X hours" setting.  There are also some tricks you can use to fool Notes into not realizing the triggers are there.

Here is a formula that woudl work:
SELECT @Year(RequestDate) = @Year(@Today) & @Month(RequestDate) = @Month(@Today)

Another way around the refresh dilamna is to catgeorize the view by month, and use the "show single category" feature of embedded views to show only the category for teh current month, e.g.

Selection formul -- select everything
First column category formula: @Text(@Year(RequestDate)) + "-" + @Text(@Month(RequestDate))
Single category formula: @Text(@Year(@Today)) + "-" + @Text(@Month(@Today))
Sjef BosmanGroupware ConsultantCommented:
Heh, @Year and @Month. Brilliant :)

You read the Performance book on R5? It has some sort of solution for views with one of those 4 formulas in them, I think by using a midnight agent to refresh documents or the view itself. Must be clumsy for a large database. The larger the database, the more time-consuming the view will be. If things get VERY slow, then you could consider to
- create an agent that
- opens a view with the documents sorted by RequestDate
- gets the first document of the month (ByKey)
- retrieves all documents from that month and puts them into a folder
- display that folder to the user
Well, here's another, relatively simple way.  Instead of @Today, you use @TextToTime("[Today]").  Has the same result, but Notes/Domino does not recognize it as a time-sensitive formula.  You can then also write an agent to refresh overnight, but sometimes that does not work, and you have to Shift-F9 once a day, or use the API call to force the complete rebuild.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sjef BosmanGroupware ConsultantCommented:
That was the trick! Now I remember.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.