Lookups with DateTimes
A conversation today in AIM with Michael Bourak of domBulletin fame...
[10:57] Michael Bourak: Hi
[10:57] Michael Bourak: got a pb for a guru ;)
[10:57] Me: shoot
[10:58] Michael Bourak: in Lotuscript, is there a way to list all calendar entries between one date and another date ?
[10:58] Michael Bourak: assuming I don't want to iterate over the whole calendar view
[10:58] Michael Bourak: ideally would need a getAllDocumentsByKey (startdate)
[10:58] Michael Bourak: or something ;)
(click permalink for full details)
[10:59] Me: you should be able to do getAllDocumentsByKey
[10:59] Me: you just have to make sure your key is actually a NotesDateTime object
[11:00] Me: oh wait
[11:00] Me: you want a date range
[11:00] Me: lol
[11:00] Me: hrrmm
[11:00] Michael Bourak: yes ;)
[11:00] Me: try it with a date range
[11:00] Michael Bourak: and I'm not sure an event exist on startdate
[11:00] Me: make a date range object and use that as the key
[11:00] Me: it might work
[11:00] Michael Bourak: maybe an event on startdate + 2 days exists ;)
[11:00] Me: alternatively, you'll have to build a view navigator and iterate over that
[11:00] Me: but that's really fast
[11:01] Michael Bourak: but if users has say, 10000 calendar entries...
[11:01] Michael Bourak: it will be slow ;)
[11:02] Me: you don't necessarily have to iterate over every one
[11:02] Me: just between the entries that as as close as possible to your start & end date
[11:02] Me: it'll be a lot of code
[11:03] Me: I would definitely try creating a NotesDataTimeRange object...
[11:03] Me: and doing a getAllEntriesByKey with that
[11:03] Me: just to see what happens
[11:03] Michael Bourak: ok, let me try this way if this works ;)
[11:03] Michael Bourak: if this works, I owe you a beer
[11:03] Michael Bourak: ;)
[11:03] Me: lol
[11:03] Me: dude, if it works, I'll be really impressed with Westford :)
[11:04] Michael Bourak: lol
[11:11] Michael Bourak: you know what ?
[11:11] Michael Bourak: that seems to work !!!
[11:28] Me: really?
[11:28] Me: ahahaha
[11:28] Me: awesome!
[11:42] Michael Bourak: maybe it only works on calendar views
[11:42] Michael Bourak: not sure
[11:42] Michael Bourak: but at least it works ;)
I can only find one mention of this approach on Google, almost two years ago on Codestore, by Glen Rohrer. Strangely, Jake ended up not using the technique for his actual problem.
It strikes me that using this technique to populate a folder would be pretty trivial and extremely flexible.
Enjoy!




Comments
Cool! Had a similar requirement/ question from another Lotus Notes user recently. It was a scenario that lent itself perfectly to an Embedded View - Show Single Category scenario (somebody picks a doctor, and all appointments for that doctor show up in the view), except the embedded view had to be a calendar view. Unfortunately, folders don't support calendar format, so the other 'normal' solution is out! Any bolts of lightning???
Posted by Ranjit At 12:39:27 PM On 12/12/2007 | - Website - |
I'm in the middle of something else on my Notes 7 client, but I just tried this in Notes 8, and it works like a charm. I created a new folder, copied all the columns from my $Calendar view, pasted them in, and set the Folder to Calendar format. Then I put a couple of entries into it.
Design - Preview, it's all good.
Just for good measure, I embedded that in a form and previewed. Still okay.
This was in Notes 8 Basic.
Posted by Nathan T. Freeman At 01:53:08 PM On 12/12/2007 | - Website - |
Posted by Charles Robinson At 04:05:15 PM On 12/12/2007 | - Website - |
Posted by Ranjit At 05:42:31 PM On 12/12/2007 | - Website - |
Tsk. Domino Designer Help (often) rules...
Posted by Ben Poole At 05:48:53 PM On 12/12/2007 | - Website - |
This is a great candidate for going in the upcoming IBM Lotus Domino Wiki site.
Posted by Nathan T. Freeman At 10:25:44 PM On 12/12/2007 | - Website - |
Posted by Bruce Elgort At 10:08:35 AM On 12/13/2007 | - Website - |
{ Link }
Posted by Bruce Elgort At 10:13:00 AM On 12/13/2007 | - Website - |
{ Link }
Posted by Nathan T. Freeman At 11:28:44 AM On 12/13/2007 | - Website - |
Posted by Mikkel Heisterberg At 10:41:06 AM On 12/15/2007 | - Website - |
Posted by Alan Bell At 09:31:25 AM On 12/18/2007 | - Website - |
Posted by Mirek Navratil At 08:39:59 AM On 01/02/2008 | - Website - |
Amusing.
Sean's one of the more creative problem solvers in the Domino community when it comes to indexing, so it doesn't surprise me that he spotted this capability over a year ago. Thanks for the pointer.
Posted by Nathan T. Freeman At 03:22:13 PM On 01/02/2008 | - Website - |