Focal Point
[SOLVED] Parameter data contains single quote, how to let the -DEFAULT and where stat

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3257018516

January 24, 2012, 03:14 PM
TechLights
[SOLVED] Parameter data contains single quote, how to let the -DEFAULT and where stat
The SQL needs to read data in string format as parameters from -DEFAULT. The data may contain single quote as part of the string. WebFocus treats the single quote as the end of the string. Therefore, it causes mismatching of the original second single quote at the end of the string.

For example:

-DEFAULT &FACILITY = ‘BOARDING PLATFORM 20' BAYLINER’
.
.
.
Where FACILITY = ‘&FACILITY’

Are there anyways for me to deal with -DEFAULT and where statements?

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


7703 on Linux, Windows
ReportCaster
PDF, HTML, Excel, AHTML, and CSV
January 24, 2012, 03:32 PM
njsden
To have a quote withing quotes you'll have to "double it".

To later embed your &variable in SQL passthru I would advise that you rely on .QUOTEDSTRING

See this:

-DEFAULT &FACILITY = 'BOARDING PLATFORM 20'' BAYLINER'
.
.
.
SQL
SELECT ... FROM ...
WHERE FACILITY = &FACILITY.QUOTEDSTRING
..
END




Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
January 24, 2012, 03:52 PM
Waz
If you are using FOCUS to do the query, then please use WHERE FACILITY EQ '&FACILITY'


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 24, 2012, 05:32 PM
TechLights
Thanks for the replies.

The ‘BOARDING PLATFORM 20' BAYLINER’ comes from a drop down selection, how can I find the quote and double it?


7703 on Linux, Windows
ReportCaster
PDF, HTML, Excel, AHTML, and CSV
January 24, 2012, 05:53 PM
Waz
Have a look at the function STRREP.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 25, 2012, 08:02 AM
njsden
quote:
how can I find the quote and double it?


You don't have to. That's what .QUOTEDSTRING is supposed to take care of!

If you are providing the value as a constant within your code (your -DEFAULT line) then you'll have to use a double apostrophe as I showed above. FOCUS will still keep one internally.

However, when the variable already contains the internal quote because it was either read that way from a file or provided to it as a parameter (your case) then no extra step is required.

As long as you favour coding &VARIABLE.QUOTEDSTRING over '&VARIABLE' FOCUS will take care of the rest.


The Developing Reporting Application manual contains documentation on .QUOTEDSTRING which you'll surely find useful and does a much better job at explaining this matter.

Hope this helps.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.