One of the functions I found customers often requesting was a view where something in the view selection formula or column formula required comparison to today’s date. But we all know @Today is not recommended in views because of the performance issues.

This is a little agent I created to allow me to hard-code a date in a view’s selection formula, but update it daily. The view selection formula is e.g.

today:=[29/12/2009];SELECT Form=”Document” & MarkForDeletion != “1” & LiveRefs = “” & ArchiveDueDate < today & Archived != “1”

I use a list to hold the views – alternatively this could look to a profile or keyword. Because it’s a list I call ‘erase’ at the end to cleanup the memory. It expects any view or column formula that needs updating to start “today:=”, and amends the currently set value with today’s date in dd/mm/yyyy format. It then creates an adminp process to sign the database with the server’s ID. The reason for this is that updating the view via script leaves the view unsigned, so if a user opens the view, they get a warning message.

Because of the adminp process, the agent needs to run with the security setting “2. Allow restricted operations”.

The agent is set up to use OpenLog, if you don’t use it just remove the “Use” statement and amend the error block accordingly.

 

3 thoughts on “Views Related to Current Date”

  1. Tip: You can use

    FIELD today := [29/12/2009]

    instead of

    today := [29/12/2009]

    This way, you can re-use the value of “today” in Column formulas too (no need to loop through column formulas).

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top