Focal Point
[SOLVED] Issue with quotes in TITLETEXT

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

June 20, 2011, 05:02 PM
nsk110483
[SOLVED] Issue with quotes in TITLETEXT
Hello All,

I am providing the code below. I have issue with Titletext.
&MDSE is passed from a field of a table. It is 50 characters long.
The field text contains "," and "'" symbols in the text.
If the text is "It is Adam's desktop". My report is not executing .. Titletext only takes "It is Adam" and it does not understand what is following keyword (in this case "s desktop").

Please help how I could solve this issue. I tried changing the single quotes to double for TITLETEXT, then I have issue with the text containing ",".

  
TABLE FILE MTA
PRINT UDA_VAL_N
BY MDSE_TYPE_N AS ''
ACROSS ATTR_N AS ''
WHERE MDSE_TYPE_N EQ '&MDSE';
ON TABLE PCHOLD FORMAT EXL2K &FLAG
ON TABLE SET PAGE-NUM OFF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=LANDSCAPE,
$
TYPE=REPORT,GRID=OFF,FONT='ARIAL',SIZE=10,COLOR='BLACK',BACKCOLOR='WHITE',STYLE=NORMAL,BORDER=0.5,TITLETEXT='&MDSE.EVAL',$
-*TYPE=TITLE,STYLE=BOLD,COLOR='BLACK',BACKCOLOR=RGB(159 217 253),JUSTIFY=CENTER,$
TYPE=ACROSSTITLE,BORDER-LEFT=OFF,BORDER-RIGHT=OFF,BORDER-TOP=OFF,$
TYPE=ACROSSVALUE,STYLE=BOLD,BACKCOLOR=RGB(200 200 200),$
ENDSTYLE
END

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


In Focus since 2008
WebFOCUS 8.2.0.1
Windows 7 - IE,Chrome,Firefox
Excel, PDF, HTML, AHTML, XML
JavaScript, jQuery, D3.js, Highcharts
June 20, 2011, 05:55 PM
Waz
My suggestion is to change the single quotes to the '`' character for the TITLETEXT.


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!

June 20, 2011, 06:14 PM
Francis Mariani
I can see why the single quote causes a problem:
...,TITLETEXT='&MDSE.EVAL',...
would evaluate to
...,TITLETEXT='It is Adam's desktop',...
which is invalid WebFOCUS syntax.

The documentation states:
quote:
Naming of Worksheets. The default worksheet tab names will be Sheet1, Sheet2, and
so on. You have the option to specify a different worksheet tab name by using the
TITLETEXT keyword in the stylesheet. For example:
TYPE=REPORT, TITLETEXT='Summary Report', $
Excel limits the length of worksheet titles to 31 characters. The following special
characters cannot be used: ':', '?', '*', and '/'.


I tried a comma in a titletext attribute and it works:
-SET &TITLETEXT='TEST,REPORT';

TABLE FILE CAR
PRINT
*
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE *
TYPE=REPORT, TITLETEXT='&TITLETEXT', $
ENDSTYLE
END
-RUN

I would use CTRAN to remove the apostrophe. I would also use CTRAN to remove the other specified special characters.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 20, 2011, 06:33 PM
nsk110483
Waz,

i have used your suggestion, but strrep did not work. Plz check my code below

 -READ HOLDFILE &MDSE.A50.
-SET &MDSE1 = STRREP(&MDSE.LENGTH, &MDSE, 1, ',', 1, '`', &MDSE.LENGTH, 'A&MDSE.LENGTH'); 


sourcecode
  
 -SET &MDSE1 = STRREP(50, Children's Nutritional Supplements                , 1, ',', 1, '`', 50, 'A50');
 -SET &FLAG = IF 45 EQ 1 THEN 'OPEN' ELSE IF 45 EQ       82 THEN 'CLOSE' ELSE '';
 -TYPE Children's Nutritional Supplements
 Children's Nutritional Supplements
 -TYPE Children's Nutritional Supplements
 Children's Nutritional Supplements
 -*================================




In Focus since 2008
WebFOCUS 8.2.0.1
Windows 7 - IE,Chrome,Firefox
Excel, PDF, HTML, AHTML, XML
JavaScript, jQuery, D3.js, Highcharts
June 20, 2011, 09:14 PM
Francis Mariani
That really isn't source code, it's the result of executing source code.

-SET &MDSE1 = STRREP(50, Children's Nutritional Supplements                , 1, ',', 1, '`', 50, 'A50');
This looks like you're replacing a comma by an accent. To replace an apostrophe, change
','
to
''''



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 20, 2011, 09:26 PM
Francis Mariani
In the past and not for titletext, I've replaced apostrophes with "Right Single Quotation Mark":

-*-- Convert Apostrophe to Right Single Quotation Mark -------------------------
-SET &VAR1 = 
-  CTRAN(&VAR1.LENGTH, &VAR1, BYTVAL('''','I3'), BYTVAL('’','I3'), 'A&VAR1.LENGTH');

I just tried this with TITLETEXT and it does not work well - the Right Single Quotation Mark does not display properly.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 20, 2011, 10:09 PM
j.gross
Instead of
  '&MDSE'

or
  '&MDSE.EVAL'


use
  &MDSE.QUOTEDSTRING

(not enclosed in quotes)

This message has been edited. Last edited by: j.gross,
June 20, 2011, 10:31 PM
j.gross
One more suggestion:

Since you have
BY MDSE_TYPE_N
coupled with
WHERE MDSE_TYPE_N EQ [a unique value];
you could skip the TITLETEXT bother and just use BYTOC to name the worksheet, leaving it to webfocus to remove characters that offend Excel.