Info service uses the list of info rules to recognize and process the received messages.
When a message arrives, the service steps through the rules, in the order of their ID values, to find a rule for which the message matches the specified pattern and the required number of parameters. If a rule is found, it is used to process the message.
For example, assuming that there is a rule with pattern bank * and the required number of parameters is set to 2, a message bank balance 1234-5678 will be recognized as this rule and the two parameters will be extracted: balance and 1234-5678. Note that the text parameters %P%, %P1% and %P2% will have the values of balance 1234-5678, balance and 1234-5678, respectively.
The Action property of the rule defines how the message will be processed. These are the possible values:
See Info Rule Dialog for the list of all rule properties.
Reply with predefined text
This action returns the predefined text as a reply. The reply text may contain Info Text Parameters, Message Text Parameters, and Global Text Parameters.
Run SQL query
This action will execute the SQL query. The query will be sent to the ODBC Data Source specified in the Info Setup Dialog. As a result set, SQL query will return a table of fields.
The Reply when query returns data setting is used for composing the reply text that should be sent in case that the result set contains any data. If the result set is empty, then the Reply when there is no data text is used.
To access the fields from the result set, you can use the %Rn% text parameter, where n is the field index. The fields are numbered by columns, and numbering continues with each new row.
For example, if the SQL query returns a table with 3 columns and 2 rows, then the filed numbering will be as follows:
Besides common SELECT query, SMS Studio also supports other queries such as INSERT, UPDATE and DELETE, which do not return result sets by their nature, but may affect a number of records. In these cases, the number of affected (inserted, updated or deleted) records is returned as a result set in %R1% parameter. If no records were affected, returned result set is empty. Note that the INSERT query cannot return empty result set, if no records were inserted that may only be caused by an error.
The reply text may also contain Info Text Parameters, Message Text Parameters, and Global Text Parameters.
Example 1
If there is a table in a database with city names and current temperatures, and a rule with the following properties:
Then, if the received message text is temp NY, and the query result set is New York 98, then the following reply will be sent:
If the received message text is temp NC, and the query result set is empty, then the following reply will be sent:
Example 2
You can easily store incoming messages into external database by using the INSERT query, by adding a rule with the following properties:
Note that it depends on the database manager and the international settings of the date and time format you are using on your computer, whether the date and time values will be correctly interpreted. If your database manager does not understand your localized format, you may need to use custom formatting of the %MsgDate% and %MsgTime% parameters which is described in Message Text Parameters.
Execute external application
This action executes external application (e.g. Visual Basic scripts, Java scripts, .exe, .bat, etc.) which processes received message.
The Application parameters setting will be used to produce the command line parameters for the application. You may use Info Text Parameters, Message Text Parameters, and Global Text Parameters to compose application parameters.
The application should process its command line parameters and perform desired operations. When the application finishes, it should set the ExitCode to zero if the processing was successful, otherwise, ExitCode should be set to a nonzero value. If the application does not return for the specified timeout period the processing will be considered as failed.
Applications can use named pipe to send SMS messages. See Named Pipe for more details.
Get reply from text file
This action reads the text file to obtain the reply text.
To minimize unnecessary reads to the file that does not change frequently, set the Minimum reading delay to appropriate value. In case that the delay is set to a value greater than 0, SMS Studio will cache the file contents for the specified period of time, thus using the same text for several consecutive requests.
Disabled
The rule is disabled and no action is performed. The status of the matching messages in the Info Inbox is set to Disabled.
This tab displays the list of info rules.
Use Action - Up/Down to arrange the list of rules prior to using Tools - Renumber option.
Use Tools - Renumber to renumber the ID values of the rules using their current order in the list.
Use Tools - Reply Options - Set Priority to set the priority of the selected replies.
Use Tools - Reply Options - Account - Select/Clear to specify the account to be used for sending the reply.
Use Tools - Reply Options - Set Address to specify the address of the sender of the replies for the selected rules.
Use Pattern Test Bar to test how the rules are recognized. While you type the text, you can see if and how that text is recognized.
| Copyright © 2002-2007 CodeSegment. All rights reserved. |