Hopefully you guys can help with my dilemma. In my database, when a user creates a new document, during the querysave event I have a bit of LotusScript that counts all of the documents created that day. However, it is actually just counting all of the documents created by that user that day. I need it to count all of them. However, they can’t see all of the documents in the database (and I can’t let them).
I hope that made sense, and that it was CRISPY enough for you - if not, let me know and I’ll fry harder (bad pun, I know, but it’s early).
If you don’t have readernames, then it’s simple enough to make a flat hidden view with one column for name and date (e.g., Fred Merkle~20061115) and just get that doc collection and count it.
If you are using readernames, though, then it’s a bit more difficult because of performance. You could categorize and collapse that view, put a total column in, and use notesnavigator to get the results from the total column for the correct category (same as above).
If there aren’t many users, you could also maintain a kind of profile doc for each user, but I would hate to mess with that if more than a few users.
I’m sure there are many other ways, just trying to think of things that won’t be too time consuming or a hassle to maintain …
If you are counting documents in QuerySave you use the user’s access rights to count documents and might miss some docs. So, depending on the users access hierarchy the results can differ.
It’s best to trigger an agent in QuerySave running on the server in order to have really all documents in the view. The user’s Common Name could be passed to the agent in order to have user dependent results. Only one disadvantage: The counting results will return asynchronously.
I looked at other ways of sequential numbering, including those on the forum and in the sandbox. This is part of my attempt, yes. I get points for trying, right?
Only if there is a way for us to tell that you tried, what you tried, and why those techniques don’t need your needs. Because there might be a way to fix one of them, that will work better than the alternative you chose for us.
True crispiness would be for you to tell us in your original post what your goal is.
One way to detect number of documents created today, is with a view which is categorized by date, descending, and has totals, which you can read off the first category using NotesViewNavigator.GetFirst. Set the view to not hide empty categories. Don’t forget to also check the date on the first row, whether it is today.
It’s kind of a waste to have a view just for this, and this also requires that there are no local replicas, no documents deleted during the day, and that time zones aren’t an issue (i.e. there might be some disagreement on what date a document was created on). Also, it doesn’t sound like you’re handling timing conflicts which result in a duplicate key.