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 nameThis message has been edited. Last edited by: FP Mod Chuck,
WebFOCUS 8.2.01M on Windows 10
July 30, 2019, 10:59 AM
Mike Williams
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
July 30, 2019, 11:19 AM
Hallway
Can you give a code example using the CAR file?
Hallway
Prod: 8202M1
Test: 8202M4
Repository:
OS:
Outputs:
July 30, 2019, 11:34 AM
ccollier
My variable is either a 'Y' or 'N'. Using &var.QUOTEDSTRING gives me '''Y''' or '''N'''.
WebFOCUS 8.2.01M on Windows 10
July 30, 2019, 11:44 AM
MartinY
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:
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.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
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.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
July 30, 2019, 04:27 PM
Waz
Apart from all the suggestions, STRIP should work. Used it on &Vars many times
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
July 30, 2019, 06:18 PM
Hallway
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
Prod: 8202M1
Test: 8202M4
Repository:
OS:
Outputs:
July 30, 2019, 06:41 PM
Waz
In 8.1.04 it says "Removes a character from a string. Use STRREP instead."
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
July 30, 2019, 06:52 PM
Hallway
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
Prod: 8202M1
Test: 8202M4
Repository:
OS:
Outputs:
July 30, 2019, 07:15 PM
Waz
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.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
July 30, 2019, 08:21 PM
Hallway
Figures. IBI is consistent in their inconsistencies.