SetSearchExpr and special characters (Doc ID 543203.1)

Last updated on MARCH 02, 2017

Applies to:

Siebel Tools - Version 7.7.2.1 SIA [18353] and later
z*OBSOLETE: Microsoft Windows 2000
Product Release: V7 (Enterprise)
Version: 7.7.2.1 [18353]
Checked for Relevance on 7-MAR-2016.
Database: Microsoft SQL Server 2000 SP3
Application Server OS: Microsoft Windows 2000 Server SP 4
Database Server OS: Microsoft Windows 2000 Server SP 4

This document was previously published as Siebel SR 38-3064203411.


Goal

We need to query contact BC using eScript with search criteria as:
Last Name: O'Neal
First Name: Robert
Work Phone #: 3154323300
The character quote (') in last name is causing the problem in query.
I searched the support web & checked the most of the SRs (e.g 38-894480151 & FAQs on search expr)on this issue.
After referring to them, when I set the search expression as:

strsrchExpr = "[Last Name] = '" +val2.replace(/[']/g, "''")+ "' AND [First Name]= '" +val1.replace(/[']/g, "''")+ "' AND [Work Phone #]= '" +val3+ "'";


[Note that we already defined val1=Robert,val2=O'Neal,val3=3154323300]
The string 'strsrchExpr is formed as below:

[Last Name]= 'O''Neal' AND [First Name]= 'Robert' AND [Work Phone #]= '3154323300'


Though this does not give any syntax error, this does not return the record in query.

Then we tried as:

var strsrchExpr = "[Last Name] = '" +"\""+val2.replace(/[']/g, "''")+"\""+ "' AND [First Name]= '" +val1.replace(/[']/g, "''")+ "' AND [Work Phone #]= '" +val12+ "'";


This again doesn't give syntax error but string formed as below does not return the record either.

[Last Name] = '"O''neal"' AND [First Name]= 'Robert' AND [Work Phone #]= '3154323300'



How can we set search expr to query string with quote(') in it, in eScript?

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms