cancel
Showing results for 
Search instead for 
Did you mean: 

Write a NXQL query to purge deleted documents

Pierre_Jenicot1
Star Contributor
Star Contributor

Hi,

I want to create a purge of deleted documents for more than 2 months after the last modification date.

Can we write a NXQL query like this :

SELECT * FROM Document WHERE ecm: currentLifeCycleState = 'deleted' AND (dc: modified + INTERVAL '2 month') < TIMESTAMP '2012-08-30 14:00:00'

Or another method?

thank you

2 REPLIES 2

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

Hi,

The better is to use an automation chain and fetch by query documents to remove definitely.

So here is the request I would put into the Fetch > Query operation (becarefule no space between "ecm and :" and "dc and :):

SELECT * FROM Document WHERE ecm:currentLifeCycleState = 'deleted' AND dc:modified < TIMESTAMP '@{CurrentDate.months(2).format("yyyy-MM-dd HH:mm:ss")'

Florent_Guillau
World-Class Innovator
World-Class Innovator

NXQL does not have date interval arithmetic. It could be added though.

Getting started

Attention: Blogs & Forums are in READ-ONLY mode from Oct 9-19 as we transition to our new platform. Learn more.

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.