Focal Point
[CLOSED]Replace an underscore by %20

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

February 17, 2017, 01:46 AM
Prajakta
[CLOSED]Replace an underscore by %20
Hello,

I have link in a column. This link has lot of sblank spaces in it. The link works fine in the PDF and HTML output format of the report whereas it does not work properly in the excel sheet. I have replaced all these spaces with an underscore and now I want to replace these underscores with "%20". I know we can replace one character with another but not one character with a string.
Can somebody guide me.

This message has been edited. Last edited by: <Emily McAllister>,


Webfocus 8.1.0.5
Windows, all output
February 17, 2017, 03:19 AM
Tony A
quote:
I know we can replace one character with another but not one character with a string.

Really? Have you read the help file on STRREP?

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 
February 17, 2017, 03:33 AM
Prajakta
Yes I read the article for STRREP but it says only one character will be replaced. In the example given for the STRREP they have replaced a special character $ with USD. But in my case I have to replace blank spaces with "%20" which is a combination of special character and alphabets.

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


Webfocus 8.1.0.5
Windows, all output
February 17, 2017, 03:54 AM
Wep5622
It's a combination of printable ASCII characters. There's nothing special about them. STRREP will do what you need.

It's easy to prove with a simple test case:
-SET &SAMPLE = 'STRREP will replace spaces with %20';
-SET &REPLACED = STRREP(40, &SAMPLE, 1, ' ', 3, '%20', 50, 'A50');

-TYPE "&SAMPLE" was replaced by "&REPLACED"

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


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 17, 2017, 05:40 AM
Tony A
quote:
But in my case I have to replace blank spaces with "%20" which is a combination of special character and alphabets.

Did you try it though?

STRREP is a string replacement Function and "%20" is just a string.

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 
February 17, 2017, 07:41 AM
Prajakta
Your example works perfectly fine but don't know why it is not working in my link with the same syntax.
I tried the same thing for Google link and it worked fine.


Webfocus 8.1.0.5
Windows, all output
February 17, 2017, 08:42 AM
Wep5622
Solving that requires that we see both the statement that you used, the input that's causing problems and the error message you got.

My first guess is that the resulting URL didn't work for you because you replaced an underscore with %20 that was already an underscore before you replaced spaces with underscores. That would result in an HTTP 404 or similar.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :