cancel
Showing results for 
Search instead for 
Did you mean: 

Getting all Documents Added or Modified to OnBase during a Period of Time

Paul_Ivany
Champ in-the-making
Champ in-the-making

Using the Unity API I need to retrieve a set of documents that were either added or modified during a period of time.  I am using a custom query and I am querying on Date Entered.  Would this be the best approach to get documents that were both added or modified (revision) during this period of time?

1 ACCEPTED ANSWER

Nevin_Steindam
Star Contributor
Star Contributor

The Document Date defaults to the date the document was stored, but OnBase allows it to be changed. And the Document Date does NOT reflect the dates of more recent revisions (unless you take it upon yourself to update the value).

I see three options. None of them are perfect:

  1. Set up your processes to enforce the rule that the DocumentDate (or a chosen keyword) always reflects this information. You CAN'T enforce that if users are allowed to do one-off imports and revision updates through the clients. However, if documents and revisions are always added through Workflow actions, other API code, Advanced Capture, etc., then you can control it. This would be the "best practice" if possible, because you're tracking a date that obviously has business value for you and is needed for searching.
    • My guess from your description is that you can have some confidence that the DocumentDate was left unchanged from the date stored, but you already have revisions in the system that didn't have their date recorded.
  2. If you are working with a very small number of documents, you can do what Brandon suggested above: Query on ALL documents that MIGHT fit, and then check the dates one by one. Documents have a "DateStored" property that always tells you the date it entered, regardless of whether the Document Date was changed. Documents also have a list of "Revisions", and each Revision has a "Date" property with the date that it was added.
    • Unfortunately, querying for EVERY document and then checking this information quickly becomes inefficient and impractical. It doesn't sound to me like you are just checking against a small set of documents. (Note: OnBase doesn't make these fields directly searchable because they aren't needed by most people. It's assumed that if they do have business value, then there will be processes similar to the ones mentioned in option #1.)
  3. Though you can't use the API (or a client) to search against DateStored or Revision.Date, those values DO exist in the database. You can figure out the appropriate SQL query and get your list that way.
    • I never like to suggest database queries as a solution, but because this is a read-only query, it is permitted. And unless my other assumptions were wrong, this is probably the only option left to you.

If at all possible, I would try to structure my solution around option #1.

View answer in original post

9 REPLIES 9

Thank you Nevin! I think I can use option #1 to get all the documents added during the time period. I'm confident our users did not modify the document date so I should get all documents added during the time period using my custom query. I'm concerned about getting all of the documents that were modified (revised) during this period. From what you said it looks like Document Date isn't updated when a new revision of a document is added. If it isn't then I may need to use two steps. I can use Option #1 to get all documents added during the time period. and then I can use Option #3 to query the database to get all documents that were modified during the time period by querying on Revision.Date. Does that sound okay to you?

Thanks again for your help!

Hi Paul. Yes, that sounds like a good strategy. The only thing I'd add is to be aware of overlaps between the two scenarios: If a document was added and revised during the one time period, you may not want to get it twice. (Depending on the SQL query, the initial creation of the document may even show up as "adding revision 1".) Likewise, I don't know what you want to do with documents that were created in a certain date range but then revised AFTER the search period ended. They will be found by your API query, but I don't know if you want to exclude them or not.

Thanks Nevin. That's a good point, I'll make sure I check for overlaps. One last question, how are revisions stored in the database? Which table are they stored in?

Thanks Again,
Paul

I actually don't know the table name offhand. I know that the data is there, since it's accessible in the clients (and API), and I imagine that the columns largely match up to the information you can see when you look at a document's revision history. But because it's not my area of expertise, I don't want to point you to a specific table and imply that I know what I'm talking about 🙂

No worries Nevin. Thanks again, I really appreciate your help.