Focal Point
[SOLVED] STRREP function question
May 28, 2014, 04:40 PM
Suzy [SOLVED] STRREP function question
I'm using the GETTOK for the labels from a launch page. The problem is that some labels contain # character. How can I add the STRREP function to replace # with %23?
-SET &HLBL = GETTOK('&LISTLBL.EVAL',&LISTLBL.LENGTH, &I, '~', &LISTLBL.LENGTH, 'A&LISTLBL.LENGTH');
-SET &HLBL_LEN = ARGLEN(&HLBL.LENGTH, &HLBL, 'I5');
-SET &HLBL.&I = SUBSTR(&LISTLBL.LENGTH, &LISTLBL,1, &HLBL_LEN.EVAL, &HLBL_LEN.EVAL, 'A&HLBL_LEN.EVAL');
I've tried this:
-SET &HLLISTLBL=STRREP(&LISTLBL.LENGTH, '&LISTLBL.EVAL', 1, '#', 3, '%23', &LISTLBL.LENGTH, 'A100');
This message has been edited. Last edited by: <Kathryn Henning>, June 03, 2014 02:19 PM WebFOCUS 8.0.08 Solaris HTML, PDF, XLS, CSV
May 28, 2014, 05:03 PM
Francis Mariani This seems to work:
-SET &LABEL1 = '#IAMALABEL';
-SET &HLABEL1 = STRREP (&LABEL1.LENGTH, '&LABEL1.EVAL', 1, '#', 3, '%23', 100, 'A100');
-TYPE &HLABEL1.LENGTH
-SET &HLABEL1 = TRUNCATE(&HLABEL1);
-TYPE &HLABEL1.LENGTH
-TYPE LABEL1: &LABEL1
-TYPE HLABEL1: &HLABEL1 I added the TRUNCATE to truncate the data after the STRREP.
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
May 28, 2014, 05:05 PM
Francis Mariani You're substituting 1 char (#) by 3 chars (%23), so the in and out LENGTH cannot be the same in the STRREP function.
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
May 29, 2014, 08:51 AM
Ponmudi Please find the sample snippet and i have tested the same in 7.7.03
-SET &P_PARAMETERS = 'This is # hash';
-SET &P_PARAMETERS = &P_PARAMETERS||' ';
-SET &P_PARAMETERS = STRREP(&P_PARAMETERS.LENGTH, &P_PARAMETERS, 1, '#', 3, '%3A', &P_PARAMETERS.LENGTH, &P_PARAMETERS);
-TYPE &P_PARAMETERS
-EXIT
WebFOCUS release: 7.7.03 OS/Platform: Windows 2008 Output format: PDF
May 29, 2014, 10:35 AM
Francis Mariani You're substituting 1 char (#) by 3 chars (%3A), so the in and out LENGTH cannot be the same in the STRREP function.
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 02, 2014, 12:41 PM
Suzy Thanks
WebFOCUS 8.0.08 Solaris HTML, PDF, XLS, CSV