Jaziar
asked on
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?
@If(@IsNewDoc; @Today; RequestDate)
Can I have a view named Current Month - and it will show all documents that fall within the current month?
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:
@Now
@Today
@Yesterday
@Tomorrow
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))
@Now
@Today
@Yesterday
@Tomorrow
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))
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That was the trick! Now I remember.
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