Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED]There's gotta be something I missed...
Go
New
Search
Notify
Tools
Reply
  
[CLOSED]There's gotta be something I missed...
 Login/Join
 
Guru
posted
Please help me bring back my sanity.

Yes. We're still on 7.7.03. Don't judge.

I'm connecting to an Oracle 10g table.

I have a field that has has a value with an apostrophe.

So, I do a simple TABLE FILE as follows:

TABLE FILE MYTABLE
PRINT *
WHERE MYFIELD EQ 'O''Brien';
END

Doesn't work.

TABLE FILE MYTABLE
PRINT *
WHERE MYFIELD EQ 'O'Brien';
END

Doesn't work.

TABLE FILE MYTABLE
PRINT *
WHERE MYFIELD EQ 'O' || '''' || 'Brien';
END

Works.

REALLY? I have to convert the &var that represents the value O'Brien to all that? I'm getting a headache just thinking about the steps I have to go through to do it, especially since the value is coming from a multi-select combobox with values in quotes separated by OR... I already have a headache thinking about converting ' to '' as it is.

Okay, so... first of all, is there some trick to multi-select that will double apostrophe the apostrophes as it adds the quotes and OR?

Secondly, do I really have to split the apostrophes out and concatenate them to the rest of the values?

Have I gone cuckoo?

This message has been edited. Last edited by: <Emily McAllister>,


WF 8.1.05 Windows
 
Posts: 332 | Location: Orlando, FL | Registered: October 17, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Once you manage to stuff O'Brien into &var, e.g.
-DEFAULT &var=O'Brien

use
WHERE MYFIELD EQ &var.QUOTEDSTRING;
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I just tested this in WF 8105 and 'O''Brien' works. The data is in a FOCUS file.


WebFOCUS 8206, Unix, Windows
 
Posts: 1713 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
Also, turn SQL traces on to see the SQL generated by WF. Your original code should work.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Guru
posted Hide Post
Creating a Standard Quote-Delimited String

Character strings must be enclosed in single quotation marks to be handled by most database
engines. In addition, embedded single quotation marks are indicated by two contiguous
single quotation marks. Quotation marks are required around variables containing delimiters,
which include spaces and commas.
The QUOTEDSTRING suffix on a Dialogue Manager variable applies the following two
conversions to the contents of the variable:
Any single quotation mark embedded within a string is converted to two single quotation
marks.

Single quotation marks are added around the string.
Dialogue Manager commands differ in their ability to handle character strings that are not
enclosed in single quotation marks and contain embedded blanks. An explicit or implied -
PROMPT command can read such a string. The entire input string is then enclosed in single
quotation marks when operated on by .QUOTEDSTRING.

Note: When using the -SET command to reference a character string, ensure the character
string is enclosed in single quotes to prevent errors.

Syntax: How to Create a Standard Quote-Delimited Character String
&var.QUOTEDSTRING
where: &var Is a Dialogue Manager variable.


Creating a Standard Quote-Delimited Character String
The following example shows the results of the QUOTEDSTRING suffix on input strings.
-SET &A = ABC;
-SET &B = 'ABC';
-SET &C = O'BRIEN;
-SET &D = 'O'BRIEN';
-SET &E = 'O''BRIEN';
-SET &F = O''BRIEN;
-SET &G = OBRIEN';
-TYPE ORIGINAL = &A QUOTED = &A.QUOTEDSTRING
-TYPE ORIGINAL = &B QUOTED = &B.QUOTEDSTRING
-TYPE ORIGINAL = &C QUOTED = &C.QUOTEDSTRING
-TYPE ORIGINAL = &D QUOTED = &D.QUOTEDSTRING
-TYPE ORIGINAL = &E QUOTED = &E.QUOTEDSTRING
-TYPE ORIGINAL = &F QUOTED = &F.QUOTEDSTRING
-TYPE ORIGINAL = &G QUOTED = &G.QUOTEDSTRING

The output is:
ORIGINAL = ABC QUOTED = 'ABC'
ORIGINAL = ABC QUOTED = 'ABC'
ORIGINAL = O'BRIEN QUOTED = 'O''BRIEN'
ORIGINAL = O'BRIEN QUOTED = 'O''BRIEN'
ORIGINAL = O'BRIEN QUOTED = 'O''BRIEN'
ORIGINAL = O''BRIEN QUOTED = 'O''''BRIEN'
ORIGINAL = OBRIEN' QUOTED = 'OBRIEN'''

Note: The -SET command will remove single quotes around a string. Notice in the example
above that the result of -SET &B = 'ABC' was changed to ORIGINAL = ABC (as shown in the
output), prior to the QUOTEDSTRING conversion.

Source: DN4500991.0310


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED]There's gotta be something I missed...

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.