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     [SOLVED] How to add single quotes around a value
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] How to add single quotes around a value
 Login/Join
 
Guru
posted
Hi,

I have a textbox and Iam entering multiple Id's separated by commas(say abcd,xyz1,pqrs) and while passing to the fex file I need the single quotes to be around the ID's(say something like select * from table where ID in ('abcd','xyz1','pqrs')...

Could anyone please help me on how to do this.

Thanks a lot in advance!

Regards,
Apoorva

This message has been edited. Last edited by: <Kathryn Henning>,
 
Posts: 270 | Registered: October 30, 2014Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Hi,
Perhaps you can use the STRREP function?
Concatenate a single quote to the beginning and end, then replace the comma with quote-comma-quote.

STRREP: Replacing Character Strings
The STRREP replaces all instances of a specified string within a source string. It also supports replacement by null strings.

Syntax: How to Replace Character Strings
STRREP (inlength, instring, searchlength, searchstring, replength,
repstring, outlength, output)


WebFOCUS 8.2.06 mostly Windows Server
 
Posts: 201 | Location: Johannesburg, South Africa | Registered: September 13, 2008Reply With QuoteReport This Post
Gold member
posted Hide Post
Hi,
STRREP is fucntion that solves most cases. But it also has it own limitations.

Check this thread, there is very nice solution for it:
http://forums.informationbuild...411028331#2411028331


Release: WebFOCUS 8104, AppStudio: 8105
OS: Windows
Output: HTML,Excel,Active Reports
 
Posts: 89 | Registered: November 19, 2013Reply With QuoteReport This Post
Member
posted Hide Post
Try this

''''|'value'|''''

that's 4 single quotes


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 22 | Registered: July 01, 2014Reply With QuoteReport This Post
Guru
posted Hide Post
Hi,

Thanks to all of you for your inputs...Would you mind posting a sample solution for this below CAR file :

-DEFAULT &COUNTRY=ENGLAND,ITALY;



TABLE FILE CAR

PRINT *

WHERE COUNTRY IN (&COUNTRY)

END

-RUN


Thanks a lot in advance!

Regards!
 
Posts: 270 | Registered: October 30, 2014Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Twanette is correct.
-DEFAULT &COUNTRY= 'ENGLAND,ITALY'

-SET &COUNTRY = TRUNCATE(&COUNTRY);

-SET &COUNTRY = '''' || STRREP (&COUNTRY.LENGTH,&COUNTRY,1,',',3,''',''',1000,'A1000') || '''';

-SET &COUNTRY = TRUNCATE(&COUNTRY);

The DEFAULT has to have quotes around and no semi-colon at the end, as the comma splits the value and the semi-colon is not required. The first TRUNCATE may be useful when value comes from an HTML form. The 1000/A1000 length can be any value that would work with your process.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Guru
posted Hide Post
Hi,

Thanks a lot Alan and everyone for your help.
It worked!

Regards
 
Posts: 270 | Registered: October 30, 2014Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Here's a little explanation of the 4 ticks:

One tick starts the string literal.
Two ticks escapes it - implying you want to print a single tick - as opposed to ending the string.
The very last tick closes the string literal.


webFOCUS 8203
WindowsServer 2012 R2,
Excel, PDF, HTML, ActiveReports
 
Posts: 124 | Location: Minnesota | Registered: August 26, 2013Reply With QuoteReport This Post
Guru
posted Hide Post
Hi,

Thanks a lot everyone for the help.
It worked!!

Regards!
 
Posts: 270 | Registered: October 30, 2014Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to add single quotes around a value

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