MarisP
MarisP

Reputation: 987

categorizing documents depending on their date fields

I've been stuck with an annoying problem for a while that I can't fix. I have a field in all of the documents that represents time- a date in format dd.mm.yyyy.

What I'm trying to do is to categorise them- Show the documents that have todays date, that will have todays date in closest 7 days, etc.

Here's the code (formula for the categorized field) that I have:

@If(@Today > pi_due_date; "Late docs"; @Today=pi_due_dat; "Todays docs";((pi_due_date - @Now)/86400)>0 &((pi_due_date - @Now)/86400)<7;"This weeks docs";"Future docs")

Everything was fine until today (after 12:00 PM) I noticed that this part: @Today=pi_due_dat; "Todays docs"; does not work, it does not return the document in the "Todays docs" category. Pretty much the same thing is happening to all the other categories and I don't understand what is causing this problem.

Upvotes: 1

Views: 63

Answers (2)

Karl-Henry Martinsson
Karl-Henry Martinsson

Reputation: 2795

I would like to point out that using @Today or @Now in a view (selection criteria or column value) will create serious performance issues, as the view will be constantly re-indexed. It will affect all applications on that server as well.

You may want to rethink the design, perhaps have a scheduled nightly agent that set a flag on the documents to indicate how they are boing categorized.

Upvotes: 1

Ken Pespisa
Ken Pespisa

Reputation: 22284

pi_due_dat is missing the 'e' at the end.

Assuming it is more than that, though, you'll want to make sure that you are only comparing the dates and not a date/time.

Try @Date(pi_due_date) = @Today instead.

Upvotes: 2

Related Questions