0

Do any of you know if I will run into errors with the following code come January?

SELECT (@Month(@GetField("OUT")) = @Month(@TextToTime("Today")) -1)

ClaaziX
  • 113
  • 1
  • 8
  • 1
    Set your clock ahead and find out – ElGavilan Jun 25 '14 at 15:41
  • I would, if that functionality was not disabled on my office pc - or if i had lotus notes on my home pc...thanks for your help :) – ClaaziX Jun 25 '14 at 15:42
  • 1
    Note (which you may have realised from Knut's answer): you don't need to use `@GetField` to get field values in view selection or column formulas. Just a field name (without quotes) will get the value of that field. – Scott Leis Jun 27 '14 at 06:52

2 Answers2

4

You can test if date field "OUT" is from previous month this way:

@Month(OUT) = @Month(@Adjust(@Today; 0; -1; 0; 0; 0; 0))

BUT, it is not recommended to use time-based functions (like @Today or @TextToTime("Today")) in view selections. Look here for more information.

Community
  • 1
  • 1
Knut Herrmann
  • 30,880
  • 4
  • 31
  • 67
  • I am aware of the issues using the time-based functions - yet agents are disabled by our tech team for some reason. The databse for previous month would have 2000 entries max - and would only be needed once a month. Though is it correct that using @TextToTime stops the database reindexing everytime it is accessed? But you have the problem of it not removing old files unless indexed? Thank you Knut, once again, for being so helpful. – ClaaziX Jun 26 '14 at 08:14
  • You're welcome. Yes, @TextToTime is a trick to not re-index view every time it is accessed but has the disadvantage that documents will stay in view unless next re-indexing. – Knut Herrmann Jun 26 '14 at 08:26
  • I've run into the "no scheduled agents" rule a few times. It's generally due to lack of understanding on the part of the admin team. – David Navarre Jun 26 '14 at 14:36
  • 2
    @ClaaziX - I've used `@TextToTime` in view selection formulas in at least three major Notes/Domino versions, and found that the view is consistently not updated unless its index is rebuilt. An alternative to get around this is to use a function like `@Today`, but set the view properties to refresh "Auto, at most every", and set a number of hours. – Scott Leis Jun 27 '14 at 06:58
1

You might also consider using a "user definable" column that uses @Return to abort the inclusion of any document that doesn't meet your criteria. Then you can update the corresponding profile document field in the Queryopen event of the view (if it doesn't already match the desired formula).

Andre Guirard
  • 720
  • 4
  • 7