Focal Point
[SOLVED] Ignoring an apostrophe in a string

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

August 07, 2018, 09:10 AM
ccollier
[SOLVED] Ignoring an apostrophe in a string
I am currently working on a chart that uses HTML and JavaScript. The chart requires a JavaScript array to read the data, and I'm using a WebFOCUS table to populate the array.

The way this chart works is that it takes a complete sentence and creates a word tree out of it. The only problem is that in the sentences, there are apostrophes which tricks WebFOCUS into stopping the string prematurely.


 TABLE FILE RETENTION
SUM
	COMPUTE LINESTART/A13 = '['; AS ''
	COMPUTE TABLEDATA/A750 = '''' || WITHDRAWAL_COMMENTS || '''' ; AS ''
	COMPUTE LINEEND/A3 =  '],'; AS ''
	BY WITHDRAWAL_COMMENTS NOPRINT
ON TABLE PCHOLD FORMAT ALPHA
END 


The COMPUTE TABLEDATA is the actual sentences. Would using an EDIT function help any?

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


WebFOCUS 8.2.01M on Windows 10
August 07, 2018, 09:26 AM
BabakNYC
Are you looking to strip out the ' in the sentence or keep them?


WebFOCUS 8206, Unix, Windows
August 07, 2018, 09:28 AM
ccollier
If I have to strip the apostrophe out that's ok, but I would rather keep them in.


WebFOCUS 8.2.01M on Windows 10
August 07, 2018, 09:39 AM
BabakNYC
  
TABLE FILE CAR
SUM 
COMPUTE Sentence_A/A100='Today's session won't start until 5 o'clock.';
COMPUTE Sentence_B/A100=REPLACE( Sentence_A ,'''','');
BY CAR.ORIGIN.COUNTRY
ON TABLE PCHOLD FORMAT HTML
END



WebFOCUS 8206, Unix, Windows
August 07, 2018, 09:43 AM
ccollier
Ah thank you! I wasn't aware of that REPLACE function. That worked perfectly.


WebFOCUS 8.2.01M on Windows 10