Thomas Adrian
Thomas Adrian

Reputation: 3636

How to get all documents where the date in the date field is after "Today" in XPages?

I have a view in a Notes application, the documents in this view have a date field.

In my xpages I need to display the view, but I only want to show the documents where the date in the date field is after todays date.

I have tried to use @Today as a selection or column formula in the view but can't use this as my webpage is then very slow.

How can I accomplish this without getting major lag on my webpage

Upvotes: 0

Views: 104

Answers (2)

jjtbsomhorst
jjtbsomhorst

Reputation: 1667

Another option would be to have the view categorized on that date field with a specified format. You could then loop through all the category elements until you find 'today' and stop.

This can be done with a bean that returns all elements found.

Upvotes: 0

Brian Moore
Brian Moore

Reputation: 137

The fastest solution in this case is to use a full text search. I've found it quite responsive, even if I still prefer view indices. For dynamic dates however, searches are better.

I have a simple example on my blog https://www.bleedyellow.com/blogs/DominoHerald/entry/simple_example_xpage_search?lang=en_us and Patrick Kwinten commented with some more.

The search would be something like:

[DateField]>=15/02/2006 or [DateField] > @Today

@Today in a column or view selection is constantly updating - since it is based on the current exact time - and that updates every second (or faster).

If you are dealing with non-dynamic data, what I have found quite effective is to run an agent that looks at the date, determines it's in the future, and flags it so. Then have a view with just those documents flagged. That way you get the advantages of a view. I love views.

Cheers, Brian

Upvotes: 3

Related Questions