Simple agent question

I have a field in my documents that contains a date that is 21 days after the document creation date. I am trying to create an agent that will delete any documents that have reached that age. When I try to use the field selection in the agent with ‘is after’ and a value of @today it changes the @today to todays date. I assume this will then only work for todays date but I need it to use the current ‘today’ for each day the agent is run.

Any ideas - hope I have explained this ok

Martin

Subject: Simple agent question

Let me see if I understand it…

The document has a creation date and an expiration date.

  1. The agent seeks documents in which the expiration date is equal to the current date and deletes it, or

  2. The agent seeks documents in which the creation date is equal to the current date - (“minus”) 21.

Is that correct?

If you use “@today” in a computed field, everytime you edit this document, the field will have the contents changed. To get the creation date use “@date(@created)”.

I believe the second option is “Cleaner”. Only one field needed, computed when composed and with “@date(@created)” in it.

Could that help?

Subject: RE: Simple agent question

Rubens

The document has two fields one with the creation date using @created and the other is an epiration date (computed when composed) which is the creation date + 21.

I am trying to get the agent to delete documents where the epiration date has been reached. I have selected the epiration date field and need to say when it is equal to the current date delete the document but when I enter @today in the value field of the agents add condition box it translates to the actual date of today which means that it would only ever work today.

Martin

Subject: RE: Simple agent question

You can do this without the need for the expiration date field on your document.

In the simple agent document selection select the condition by date and then date created is older than 20 days.

Subject: RE: Simple agent question

Hi Martin,

If you are comparing expirydate with today then write a simple condition

if doc.expirydate(0)= today() then

do what ever u want

end if

If u know the no. of days of document to expiry example any number 10 days or 20 days simply take the timedifference between creation date and total no. days of expiry . If this works then remove the expirydate field.

I hope this will help you.

Cheers

Raj

Subject: RE: Simple agent question

Raj

I already have a field that contains the expiry date as this is used and displayed at various times in my application. What I am trying to do is create an agent that will delete the document if the expiry date has been reached.

Martin

Subject: RE: Simple agent question

Martin

Create a view for this deletion documents view selection formula should display all expiry date reached documents.

I hope this will help.

Cheers

Raj

Subject: RE: Simple agent question

OK so if I create a new view that selects all the documents that have reached their expiry date how do I get the agent to delete those documents?

Subject: RE: Simple agent question

In the view u can have all expired date document .so delete one by one through while loop. thats it.

cheers

Raj

Subject: RE: Simple agent question

Even better

The view that is used to store expired documents should have a categorized column as its first column, which has the hard-coded value “Expired” (or even “ksdbkbf” for that matter).

Then,

keyName = “Expired” 'or even “ksdbkbf” for that matter

Set dc = view.GetAllDocumentsByKey(keyName, True)

If dc.Count > 0 Then

dc.RemoveAll

End If

Subject: Simple agent question

Instead of a “simple action” agent, write a formula agent. This should be pretty close to what you want:

 SELECT @Adjust(@Created;0;0;21;0;0;0) < @Today;

@DeleteDocument

Subject: RE: Simple agent question

Richard

That works just fine - thanks very much

Martin