Create an Agent to Search View

Sorry for the basic question, but I am having date problems. I want the view to pull up all the saved forms whose date range includes Today. I was told to create an agent that changes the view formula, but unfortunately after trying, that seems beyond me. I assume I want my agent to “Document Search” but if I put my formula in with SELECT (StartDate <= [Today]) & (EndDate >= [Today])

Won’t I have the same problem as before where Today is taking the date the formula was written and not updating daily?

Subject: Create an Agent to Search View

Uh, you say you want the view to display all saved forms whose date range includes today. Isn’t that something covered by the view selection formula? Why do you need an agent?

Subject: RE: Create an Agent to Search View

And to add to Esther response, to NOT display the documents saved Today in your view, you would have to specify it in your view selection formula!

Subject: RE: Create an Agent to Search View

The intention of whoever told you this was probably that the agent would run nightly. You would want something like the “Update Overdue view” agent in this download.

Subject: RE: Create an Agent to Search View

Thanks for all your input. Andre, I will read your article to see if it helps me. I am new to designing and have been thrown into by an overloaded IT dept that does not have time to help me with the simple questions. I am building a newspaper delivery database for a hotel. People input who wants what papers starting on StartDate and ending with EndDate. My view at this point pulls up all the forms in the database regardless of delivery dates. I want it to pull up only ones that need to be delivered today. In my view I have three columns that are date related. StartDate, EndDate and Today which I thought I could use (This column does update daily). My view formula was input as SELECT (StartDate <= [Today]) & (EndDate >= [Today])

Unfortunately, Today is replaced with the date that the formula is created and does not update daily. Someone suggested an agent that would update the view daily, but I have not worked with agents before. I have done 3 databases so far, and am learning as I go, but I have not had to update dates or use agents before. Any help would be appreciated as are your posts already. I have a feeling this is a simple thing, but I have already put about 10 hours into reading help etc.

Laura

Subject: RE: Create an Agent to Search View

OK, now that you’ve explained what you’re trying to do it makes more sense. Here’s what you need to do:

Create a view whose selection is something like this:

SELECT Form = “myForm” & deliverFlag = “yes”

Now create a scheduled agent that runs around 1 am (since you want to use today’s date as a flag, not tomorrow’s, you don’t want it to run during the night.) Set it to run on All Documents in Database (or, if you have other types of documents you don’t want included, set up the document selection section.) Set the agent formula to this:

@If(StartDate <= @Today & EndDate >= @Today; @SetField(“deliverFlag”; “yes”); @SetField(“deliverFlag”; “no”))

The agent will run very early in the morning, and then when someone comes in and looks at the view to see who should receive newspapers that day, the view will only display documents whose deliverFlag field is yes (the ones the agent determined were active on this particular day.)

Subject: RE: Create an Agent to Search View

That’s one way to do it, but it has the disadvantage of modifying documents unnecessarily, causing lots of churn in the view indexes. The person who comes in the next morning may have to wait a while for the view index to be regenerated to include all the changes – in every view. Also, you use the useful “last modified” date maintained by the system, the changed documents may trigger other agents that run on “new and changed” documents, and unread marks are messed up.