0
votes

I cannot get my filter to work when filtering by date.

I have a view with a categorized date in the first field.

In the filter by Category field I have

   session.createDateTime(@Today()).getDateOnly()

I have also tried typing in "May 23, 2014" and so on.

One question - what is the filter working on, the underlying view or the xpages data?

1
Clarification: Are you using the categoryFilter property on the view data source?Per Henrik Lausten

1 Answers

4
votes

Assuming you want to use categoryFilter on an existing view, I'm afraid the answer may be "it won't work" - I don't recall ever making it work, and my testing now didn't result in anything. The problem is similar to (probably exactly the same as) view.createViewNavFromCategory() - it wants a string, and there doesn't seem to be a way to get Domino to deal with a date there instead.

So that leaves a couple options. The "keys" parameter does indeed take a DateTime, but loses further categorization. If that's fine, you could accomplish it by tweaking your code slightly:

var dt = session.createDateTime(@Today());
dt.setAnyTime();
dt

The ".getDateOnly()" method actually returns a localized string representing the date, not a DateTime without time information.

Alternatively, if you're alright with modifying the view, I recommend changing the Date column to a locale-neutral string, such as:

@Text(@Year(Date)) + "-" + @Text(@Month(Date)) + "-" + @Text(@Day(Date))

Then, you can use a category filter like this:

new java.text.SimpleDateFormat("yyyy-M-d").format(@Today())