Focal Point
[CLOSED] STRREP

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

September 23, 2011, 03:11 PM
MSmoger
[CLOSED] STRREP
Can anyone help me understand how to do a STRREP when I am trying to replace a single quote mark (')?

Thank you,

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


WebFOCUS 7.7.03
AS400 DB2 V5R4
Windows Server 2003 64 bit SP2, All Outputs
September 23, 2011, 03:16 PM
njsden
More background info about your need would be useful but hopefully the sample code below can give you some ideas:

DEFINE FILE CAR
NAME/A10 WITH CAR = 'O''Connor';
NEW_NAME/A10 = STRREP (10, NAME, 1, '''', 1, '*', 10,  NEW_NAME);
END
TABLE FILE CAR
PRINT NAME AND NEW_NAME
WHERE RECORDLIMIT EQ 1
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.
September 23, 2011, 03:28 PM
MSmoger
Here is some more information. All of my data is right justified. I am trying to create a multiselect box with the values of A, B, C. But I need the fields to read ' A', ' B', ' C'. If I select A and B from my multiselect box the value is 'A' or 'B'. I need to modify this field to make it read like ' A' or ' B'.


WebFOCUS 7.7.03
AS400 DB2 V5R4
Windows Server 2003 64 bit SP2, All Outputs
September 23, 2011, 04:27 PM
Francis Mariani
Why not have the values in the multi-select contain that first-character blank? The blank would be passed within the variable.

How are you populating the multiselect box? If it's with static values entered from the Composer, the line of code renders like this:

<OPTION selected value=" A" noinput="0" displaytext=" A">A</OPTION>

If you're populating it via a fex, it should work as well.


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
October 04, 2011, 03:03 PM
Mary Watermann
MSmoger,

I have come up with this solution if you would like to give it a try:

-SET &NAME = ' ''A'' OR ''B'' OR ''C'' ';
-SET &NLEN = &NAME.LENGTH + 3;

-SET &NNME = STRREP ( &NAME.LENGTH, &NAME, 2, ' ''', 3, ' '' ', &NLEN.EVAL,  'A&NLEN.EVAL');

-TYPE &|NAME = &NAME
-TYPE &|NNME = &NNME


I set -SET &NAME = ' ''A'' OR ''B'' OR ''C'' ';
to have extra quotes around it for testing in the DS Editor.

If you have a string of A,B,C being passed it will most likely be like: 'A' OR 'B' OR 'C'.


WF 7.6.10, Windows, PDF, Excel
October 12, 2011, 11:53 AM
MSmoger
I will give this a try. Thank you.


WebFOCUS 7.7.03
AS400 DB2 V5R4
Windows Server 2003 64 bit SP2, All Outputs