DQL to find objects created in the last x minutes

I saw an interesting post in the documentum support forums today. This person wanted to construct a DQL to find the list of documents that were created in the last 15 minutes. However when you do a subtraction from a DATE attrinbute, content server assumes that the integer refers to a say. Thus DATE(NOW) – 15 would be 15 days in the past from today.

I decided to see if content server could do fraction of a day. I tried doing r_creation_date > DATE(NOW) – (1/24) and expected to see documents created within the past hour. However, this did not work. Probably because the underlying DB (MSSQL 2005 SP2) does not support fractions. So I decided to see if replacing the proper fraction by a rational number would work. So I decided to replace 1/24 by 0.0414 to give me this expression r_creation_date > (DATE(NOW)-(0.0414)) and it worked ! So if you want to find out the documents that were created in the past x minutes, use the following DQL

SELECT r_object_id, r_creation_date, object_name, title, r_version_label FROM dm_document WHERE r_creation_date > (DATE(NOW)-(x*0.000694)) and r_creation_date < (DATE(NOW)-(1*0.000694))

You can find the post at this link.(Login required)

Leave a comment

0 Comments.

Leave a Reply


[ Ctrl + Enter ]