Select statement in agent not working

Hi everyone,

I have an agent (Sheduled daily on all documents in database) in which the select statement is not working. When using the same statement in a view it works. In the agent, the select statement picks up everything including the documents that have the Status = “Cancelled”. In the view, the select statement picks up everything including the documents that have the Status != “Cancelled” as intented.

Can anyone tell me why this is behaving like this and how can I make the agent act on the appropriate documents as stipulated by the select statement.

ds:=DateMasterApproved;

today:=@Date(@Today);

st:=“Approved”;

SELECT Form =(“frmPO”) & MasterStatus=st & POOrderDate =“” & POConfirmDate =“” & ((today-ds)/86400>1) & Status != “Cancelled”;

divsel1:=@If(@Contains(Division;“Network Communications” : “Network” : “Telephony”); AuthorEMail : ServiceEMail ; AuthorEMail);

SendTo:=WhseMgr;

CopyTo:=“”;

BlindCopyTo:=“”;

Link:=“http://ccsnts1/po/fsmain!Open&Frame=fMid&Src=/ponumber/” + PONumber + “!Open&Login”;

Subject:=“5 - Confirm Order Placement: " + PONumber + " (” + Division + " - Job No " + GPJobNumber + “) has been Approved - add confirmation dates”;

newsub:=@If(PODesc=“”;Subject;“5 - Confirm Order Placement: " + PODesc + " has been Approved - add confirmation dates”);

REM “Send email to author and Service if division is Network or Telephony and if the POOrderDate is empty and PO not comfirmed yet and more than 1 day after approved. Otherwise only email to author”;

@MailSend(SendTo;CopyTo;BlindCopyTo;newsub;“”;@NewLine:“If the order has been placed please add the confirmation dates to the "Date PO Confirmed By Vendor" field in the Tracking grid” : @NewLine : "Follow the link to add confirmation details: ":Link);

REM “Advise SysAdmin of same”;

@MailSend(SendToSysAdmin ; “” ; BlindCopyTo ; newsub ; “” ; @NewLine:“If the order has been placed please add the confirmation dates to the "Date PO Confirmed By Vendor" field in the Tracking grid” : @NewLine : "Follow the link to add confirmation details: ":Link)

Subject: Select statement in agent not working

If you have a view that selects the documents you want already, forget the Select statement in the agent. Instead, set it to run against all documents (or all added/modified, or whatever is appropriate), then go to the Document Selection object and add the Simple condition “In folder” and select the view.