Versions
All

Purpose
This function precedes special characters in a string with an escape character.

Syntax
Code:
$L.success.flag=rtecall("escstr", $L.return.code, $L.str)
  • $L.success.flag
    true = success
    false = failure
  • $L.return.code
    returncode of the call
  • $L.str
    string to be modified.

Example
Code:
$L.str="c:\dir\sub"
$L.rc=0
$L.ret=rtecall("escstr", $L.rc, $L.str)
Before the call to "escstr", $L.str contained the following string:

c:\dir\sub

After the rtecall, $L.str contains the following string:

c:\\dir\\sub.

The backslash escape character was inserted in front of the existing backslash.

Note This function is rarely needed. The only time a string needs the escape characters added is when that string will be fed back into ServiceCenter. ServiceCenter treats any data between quotes as a string. If the data itself contains a quote then that quote must be escaped (with a backslash) so that the quote will be treated as data rather than the end of the string. Since the backslash is used as the escape character, any occurrence of a backslash in the data must also be escaped. An example of when this function might be needed is when a RAD program is constructing a query to retrieve a record based on data from some other record. In this case, the contact name in a problem ticket is used to retrieve the contact information from the contacts file. The RAD program might construct a query as follows:

Code:
$L.query = "name="+contact.name in $file
This query will not work if the contact.name from $file contains a quote or a backslash because these characters will not be properly escaped and will cause the parse of the query to end prematurely. The correct code would be:

Code:
$L.temp = contact.name in $file
$L.ret = rtecall("escstr",$L.rc,$L.temp) 
$L.query="name="+$L.temp