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] Removing quotes from a variable
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Removing quotes from a variable
 Login/Join
 
Gold member
posted
I have a variable that has quotes around it, and it's necessary to remove said quotes from the variable. How would I do that? I've tried to use things like STRIP, but it doesn't seem to like the fact that I'm passing a variable into it instead of a field name

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8.2.01M on Windows 7
 
Posts: 46 | Registered: July 30, 2018Reply With QuoteReport This Post
Silver Member
posted Hide Post
Is it the value contained within the variable that has quotes or your variable is '&var' in your code?

Have you tried =&var.QUOTEDSTRING in place of ='&var'?


WF Version 8105
 
Posts: 35 | Registered: October 07, 2015Reply With QuoteReport This Post
Guru
posted Hide Post
Can you give a code example using the CAR file?


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 363 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Gold member
posted Hide Post
My variable is either a 'Y' or 'N'. Using &var.QUOTEDSTRING gives me '''Y''' or '''N'''.


WebFOCUS 8.2.01M on Windows 7
 
Posts: 46 | Registered: July 30, 2018Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Not clear : are you saying that you have a variable that contains quotes that you want to remove or that the variable is surrounded by quotes ?

If your variable has quotes around it such as below, remove it
-DEFAULTH &CNTRY = 'ENGLAND'
TABLE FILE CAR
SUM SEATS
BY CAR
WHERE COUNTRY EQ '&CNTRY';
END

-* Can be replaced by
TABLE FILE CAR
SUM SEATS
BY CAR
WHERE COUNTRY EQ &CNTRY.QUOTEDSTRING;
END


Below code is removing quotes from variable's content:
-SET &VAR = '''MYVARWITHQUOTES''';
-SET &NVAR = REPLACE(&VAR, '''', '');
-TYPE VAR: &VAR, NVAR: &NVAR

It seems that you already receive the variable content with quotes (this is an option within IB Composer) so, do add any in the where clause neither .QUOTEDSTRING
Have your code as
-DEFAULTH &CNTRY = '''ENGLAND'''
TABLE FILE CAR
SUM SEATS
BY CAR
WHERE COUNTRY EQ &CNTRY;
END


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2097 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Guru
posted Hide Post
Try the REPLACE function
 
-SET &VARIABLE = '''Y''';
-TYPE &VARIABLE
-SET &VARIABLE = REPLACE(&VARIABLE, '''', '');
-TYPE &VARIABLE 


Docs: REPLACE: Replacing a String


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 363 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
Am I correct in thinking that you are receiving this variable from an HTML launch page constructed in WebFOCUS?

If so then go to the control properties and make sure that you are not sending a quoted value and that the control is not set to be a multiple.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5575 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
Apart from all the suggestions, STRIP should work. Used it on &Vars many times


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6069 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
Guru
posted Hide Post
IBI recommends using REPLACE instead of STRIP. If you run the code below, in the Function description for STRIP it says:
quote:
Removes a character from a string. Use REPLACE instead

TABLE FILE SYSSQLOP
BY CATEGORY
BY FUNCTION
BY FUNCTION_SYNTAX
BY FUNCTION_TYPE
BY FUNCTION_DESC
WHERE FUNCTION EQ 'STRIP' OR 'REPLACE' OR 'STRREP';
ON TABLE SET PAGE-NUM OFF
END
  

This message has been edited. Last edited by: Hallway,


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 363 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
In 8.1.04 it says "Removes a character from a string. Use STRREP instead."


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6069 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
Guru
posted Hide Post
quote:
Originally posted by Waz:
In 8.1.04 it says "Removes a character from a string. Use STRREP instead."

LOL, go figure. What does STRREP say in 8104? In 8202 it says:
quote:
Text modification, replace character strings. Use REPLACE instead.


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 363 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
LOL, go figure. What does STRREP say in 8104?


It says "Text modification, replace character strings"

And it comes under "Character" not "Character - Legacy"


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6069 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
Guru
posted Hide Post
Figures. IBI is consistent in their inconsistencies.


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 363 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
I guess that is an oxymoron.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6069 | Location: Land of the Darug people, Terra Australis Incognita | 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] Removing quotes from a variable

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