Conditional WebQuerySave agents

Jake Howlett, 10 October 2000

Category: Agents; Keywords: Condional Agent

We all know that you can run agents when a web page gets submitted, by using the WebQuerySave event of a form.

Image

So, if your form is called resource, and you want to run an agent called "SaveResource" when it is submitted you enter the following:

Image

However, notice that in the design pane shown it says "Enter a formula that runs an agent." This basically means that you can create any kind of conditional formula as long as it results in an @Command([ToolsRunMacro];"...") call. For example, say you wanted to only run the query save agent only if the field called "RunAgent" was set to "1". Use the following:

Image

The possibilities are almost endless. You could use the QuerySave agent only if it a Tuesday:

@If(@WeekDay=3;
@Command([ToolsRunMacro]; "(TuesdaySave)");
@Command([ToolsRunMacro]; "(OtherdaySave)")
)


You get the idea right ?

Note: Agents that run on the web have to be set to:
Run - Manually from agents list
On - Run once (@Commands may be used)

Also, although you name agents without the parentheses i.e ResourceSave and not (ResourceSave), Notes uses these when it references them and so you need to use them in your ToolsRunMacro @command.