ICommenceDatabaseFireTrigger Method |
Namespace: Vovin.CmcLibNet.Database
Additional information from the Commence helpfile. Note that you do not have to worry about the syntax, it is taken care of internally in CmcLibNet. See examples below.
Commence can pass data from the Send DDE Action of one agent to the Receive DDE Trigger of another agent, or an agent can be triggered by code. The data can then be used by the Receive DDE agent’s actions. The arguments passed via a Receive DDE trigger are accessible using the following keyword strings: (-0-), (-1-), (-2-), (-3-), (-4-), (-5-), (-6-), (-7-), (-8-) and (-9-). These keywords (i.e. arguments) may be used just as field codes would be used to display the data in a message box or status bar action, to set values in an add or edit item action, or any other place that keyword replacement is allowed in agents. The following example illustrates how the DDE trigger arguments are mapped to keywords.
Usage:
[FireTrigger(TrigStr, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)]
| (-0-) | Always "FireTrigger". |
| (-1-) | Trigger String, e.g., TrigStr |
| (-2-) through (-9-) | The string passed in that position, e.g. Arg2 through Arg9 respectively. |
The Send DDE trigger also allows arguments 2 and 3 to be mapped to a category name and an item name respectively. Then If the "arg2 equals" check box is checked (in the DDE Trigger Definition dialog box of the Receive DDE agent), a category must be selected and Arg2 must equal that category name for that DDE trigger to fire. In addition, Arg3 must be the name of an item in the chosen category. If all these conditions are met, the trigger fires and values from that item will be available for use in the agent’s actions (using the field name keywords such as (%Name%) or using any of the arguments (-3-) through (-9-) that have been defined)
The corresponding agent with a Receive DDE trigger also allows you to define a filter for a DDE trigger using the item mapping option. If a filter is defined, not only do Arg2 and Arg3 have to match the category and an item name, but the item must also meet the filter criteria. If the item does not match the filter, the trigger will not fire.
Examples:
Execute: [FireTrigger("test", "Person", "Wilson", "908-552-0466")]
This is a generic example where all arguments are typed literally.
Execute: [FireTrigger("test",(-Category-),(%Last Name%),(%Business Phone%))]
This is an equivalent example where the agent trigger uses the Person category, so field codes can be used as arguments whenever necessary.
string[] args = new string[] { "Company", "012-3456" }; FireTrigger("DoSomething", args);
Dim args : args = Array("Company", "012-3456") FireTrigger("DoSomething", args)