Difference between revisions of "External Data Input"
From Zenitel Wiki
(Moved description of string and temp macroes to separate pages. Cleaned up the example) |
|||
Line 21: | Line 21: | ||
|- | |- | ||
|} | |} | ||
+ | |||
*Input message | *Input message | ||
Line 28: | Line 29: | ||
*Context parameters | *Context parameters | ||
− | :- %edi is the input text where termination character is excluded | + | :- [[Edi (macro)|%edi]] is the input text where termination character is excluded |
− | :- %sev is the EDI port (sub-event) | + | :- [[%sev]] is the EDI port (sub-event) |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | :- | + | *Useful macros and statements |
− | + | :* [[%scutc]] - Extract substring by byte (character) position | |
− | ::* | + | :* [[%scutf]] - Extract field, fields defined by delimiter character |
+ | :* [[%sscan]] - Scan for string, extract rest of string after first match | ||
+ | :* [[%scmp]] - Compare strings | ||
+ | :* [[Tmp_statement|TMP]] - Set temporary variable | ||
+ | :* [[%tmp]] - Read temporary variable | ||
− | |||
− | |||
− | + | == Example == | |
− | :- | + | [[Image:EDI - External Data Input (3).jpg|thumb|right|500px]] |
− | |||
− | |||
− | |||
− | + | The rule below will allow you to issue commands to EDI port like this: | |
*connect,101,103 | *connect,101,103 | ||
− | :-Generates internal | + | :-Generates internal command '''$CALL L101 L103''' |
*disconnect,101,103 | *disconnect,101,103 | ||
− | :-Generates internal | + | :-Generates internal commands '''$C L101'''and '''$C L103''' |
+ | |||
+ | evh add edi 0 | ||
+ | tmp 0 "%scutf(%edi,\,,0)" | ||
+ | tmp 1 "%scutf(%edi,\,,1)" | ||
+ | tmp 2 "%scutf(%edi,\,,2)" | ||
+ | if %scmp(%tmp(0),connect) | ||
+ | $call l%tmp(1) l%tmp(2) | ||
+ | stop | ||
+ | endif | ||
+ | if %scmp(%tmp(0),disconnect) | ||
+ | $c l%tmp(1) | ||
+ | $c l%tmp(2) | ||
+ | stop | ||
+ | endif |
Revision as of 15:34, 17 July 2007
Event description
Event Owner: | EDI Text Config |
---|---|
Event type: | External Data Input |
Sub-Event: | 1 – 4: specifies which EDI port. 0: matches all ports |
When Change to ON: | When valid data is received on EDI port |
When Change to OFF: | N/A |
When Related to: | N/A |
- Input message
- - The EDI port is defined in the ‘Serial Ports’ Setup
- - The input message must have a termination character. Max 128 char.
- - Parsing the content is done in the action string
- Context parameters
- Useful macros and statements
Example
The rule below will allow you to issue commands to EDI port like this:
- connect,101,103
- -Generates internal command $CALL L101 L103
- disconnect,101,103
- -Generates internal commands $C L101and $C L103
evh add edi 0 tmp 0 "%scutf(%edi,\,,0)" tmp 1 "%scutf(%edi,\,,1)" tmp 2 "%scutf(%edi,\,,2)" if %scmp(%tmp(0),connect) $call l%tmp(1) l%tmp(2) stop endif if %scmp(%tmp(0),disconnect) $c l%tmp(1) $c l%tmp(2) stop endif