Technical References - triggers

Triggers provide a mechanism for doing something on a regular timed basis, or when a certain action occurs.

numero = 290
interpreted = N
texte = Triggers Currently only time-based triggers are provided, but in the future we will add new types of triggers performing some action whenever a database is modified, or a template is displayed. Triggers do their work by simulating a browser hit to a URL. They act as if you had manually used a browser to reload a page at a particular time each day. This gives you the flexibility to create as much complex WebDNA as you like, and to test it by simply using a browser to visit that URL. Once you have finished creating and testing the template, then enter its URL into a trigger and it will be executed on schedule from then on. The URL must be of the form http://www.server.com/folder/file.ext (the same as you would see in a browser window -- in fact, it is probably easiest to simply copy the URL directly from your browser window). There is no restriction on the web site in the URL, so you can actually have triggers that hit any web server in the world.

The URL can now also take the form https://www.server.com/folder/file.ext. In this case WebDNA will open a secure SSL connection (on port 443), to 'execute' the trigger.

Because it is possible the URL will fail for some reason (timeout, bad connection, bad password), triggers have a timeout and retry interval. These numbers are used to tell the trigger how long it should wait before attempting the URL again. Triggers look for a string of text (which you specify) to tell them the trigger was successfully executed. Often the text "" is sufficient, but you can put more sophisticated WebDNA into a page to create more detailed success information. The single Triggers.db file must be in the main program folder (where Users.db, ErrorMessages.db, etc. reside). An example of a useful time-based trigger is one that looks through the ShoppingCarts folder once per hour and deletes any that are more than 24 hours old. Another example is a trigger that looks for new order files in the Orders folder and initiates a credit card transaction using credit card software such as ICVerify, MacAuthorize, or CyberCash. Once the transaction is cleared, the trigger URL's WebDNA could continue by sending fulfillment emails and updating an inventory database.

Triggers will not execute until the first hit to the web site has been processed. This usually means that until the first web browser hit from the outside hits a URL ending in ".dna" or one of the other WebDNA-controlled suffixes, no triggers will execute.

FieldDescription
SKUA unique number making it easier to identify a particular trigger.
TriggerOnly TIME is allowed here
ParamFor TIME triggers, this is a specially-formatted string of numbers and asterisks representing the time the trigger should execute. For example, to cause a trigger to execute 5 seconds after each minute, the text would be
Y M D H M S (Year Month Day Hour Minute Second)* * * * * 5
To cause a trigger to execute at 9:15 PM every day, the text would be* * * 21 15 *
YearMonthDayHourMinuteSecond
* or actual year such as 1998* or month of year such as 6 for June* or day of month such as 28* or hour of day such as 23 (11 PM)* or minute of hour such as 59* or second of minute such as 15
NextExecuteThis value gets changed automatically each time a trigger executes. It changes to the date and time of the next scheduled execution of this trigger. If you do not want a trigger to start until a future date, you can preset this to the first date you want it to execute. After that, it is updated automatically.
EnableT or F to enable or disable the trigger.
ExecuteURLFull URL to the template you want executed at trigger time.
UserOptional username for this page. This is the same as an authenticated username that the [protect] tag uses. Requiring a username/password enables you to create triggers outside visitors cannot view.
PassOptional password for this page. This is the same as an authenticated password that the [protect] tag uses. Requiring a username/password enables you to create triggers outside visitors cannot view.
WasGoodA string of text returned from the URL indicating the trigger was successfully executed. The trigger looks for this text anywhere in the returned HTML from the URL page. Often <html> is sufficient to tell the trigger that it successfully received the page.
TimeoutSecondsNumber of seconds to wait for the URL to complete before giving up and trying again.
RetrySecondsNumber of seconds to wait before retrying the trigger.
triggers Currently only time-based triggers are provided, but in the future we will add new types of triggers performing some action whenever a database is modified, or a template is displayed.

triggers do their work by simulating a browser hit to a URL. They act as if you had manually used a browser to reload a page at a particular time each day. This gives you the flexibility to create as much complex WebDNA as you like, and to test it by simply using a browser to visit that URL. Once you have finished creating and testing the template, then enter its URL into a trigger and it will be executed on schedule from then on.

The URL must be of the form http://www.server.com/folder/file.ext (the same as you would see in a browser window -- in fact, it is probably easiest to simply copy the URL directly from your browser window). There is no restriction on the web site in the URL, so you can actually have triggers that hit any web server in the world.

The URL can now also take the form https://www.server.com/folder/file.ext. In this case WebDNA will open a secure SSL connection (on port 443), to 'execute' the trigger.



Because it is possible the URL will fail for some reason (timeout, bad connection, bad password), triggers have a timeout and retry interval. These numbers are used to tell the trigger how long it should wait before attempting the URL again. triggers look for a string of text (which you specify) to tell them the trigger was successfully executed. Often the text "" is sufficient, but you can put more sophisticated WebDNA into a page to create more detailed success information.

The single triggers.db file must be in the main program folder (where Users.db, ErrorMessages.db, etc. reside). An example of a useful time-based trigger is one that looks through the ShoppingCarts folder once per hour and deletes any that are more than 24 hours old. Another example is a trigger that looks for new order files in the Orders folder and initiates a credit card transaction using credit card software such as ICVerify, MacAuthorize, or CyberCash. Once the transaction is cleared, the trigger URL's WebDNA could continue by sending fulfillment emails and updating an inventory database.

triggers will not execute until the first hit to the web site has been processed. This usually means that until the first web browser hit from the outside hits a URL ending in ".dna" or one of the other WebDNA-controlled suffixes, no triggers will execute.



FieldDescription
SKUA unique number making it easier to identify a particular trigger.
TriggerOnly TIME is allowed here
ParamFor TIME triggers, this is a specially-formatted string of numbers and asterisks representing the time the trigger should execute. For example, to cause a trigger to execute 5 seconds after each minute, the text would be
Y M D H M S (Year Month Day Hour Minute Second)* * * * * 5
To cause a trigger to execute at 9:15 PM every day, the text would be* * * 21 15 *


YearMonthDayHourMinuteSecond
* or actual year such as 1998* or month of year such as 6 for June* or day of month such as 28* or hour of day such as 23 (11 PM)* or minute of hour such as 59* or second of minute such as 15


NextExecuteThis value gets changed automatically each time a trigger executes. It changes to the date and time of the next scheduled execution of this trigger. If you do not want a trigger to start until a future date, you can preset this to the first date you want it to execute. After that, it is updated automatically.
EnableT or F to enable or disable the trigger.
ExecuteURLFull URL to the template you want executed at trigger time.
UserOptional username for this page. This is the same as an authenticated username that the [protect] tag uses. Requiring a username/password enables you to create triggers outside visitors cannot view.
PassOptional password for this page. This is the same as an authenticated password that the [protect] tag uses. Requiring a username/password enables you to create triggers outside visitors cannot view.
WasGoodA string of text returned from the URL indicating the trigger was successfully executed. The trigger looks for this text anywhere in the returned HTML from the URL page. Often <html> is sufficient to tell the trigger that it successfully received the page.
TimeoutSecondsNumber of seconds to wait for the URL to complete before giving up and trying again.
RetrySecondsNumber of seconds to wait before retrying the trigger.

DOWNLOAD WEBDNA NOW!

Top Articles:

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

AWS Raw WebDNA LAMP-Plus WebServer

Amazon Web Services (AWS) README for Machine Image ID...

WebDNA Modules

A list of the currently available modules...

WebDNA reference

...

Tips and Tricks

A list of user-submitted tips ...

Download WebDNA Applications

WebDNA applications...

Related Readings:

[lowercase]

Changes all upper case letters to lower case...

[listpath]

Breaks a path into separate foldernames and a filename...

[switch]

Executes the WebDNA inside the only [case] context which matches the given value...

[protect]

...

[input]

[url]...

[encrypt]

[encrypt] and [decrypt] allow you to store sensitive data in your databases without risk of exposing it to prying eyes...