February 10, 2014, 04:45 PM
Joel Elscott[SOLVED] Reformat of input variable
Hi,
I need to reformat the following variable into a new variable with an entirely different format. How can this be done?
Incoming variable value: (small|large|huge)
The income variable values will be assigned a "code":
small = 3
large = 12
huge = 8
I also need to have comma's between each code.
Final output variable format needed: (3,12,8)
Thanks in advance!
This message has been edited. Last edited by: <Kathryn Henning>, February 10, 2014, 09:25 PM
Francis MarianiUse the function STRREP:
-SET &VAR1 = '(small|large|huge)';
-SET &VAR1A =
- STRREP (&VAR1.LENGTH, &VAR1, 5, 'small', 1, '3', &VAR1.LENGTH, 'A&VAR1.LENGTH');
-SET &VAR1A =
- STRREP (&VAR1A.LENGTH, &VAR1A, 5, 'large', 2, '12', &VAR1.LENGTH, 'A&VAR1.LENGTH');
-SET &VAR1A =
- STRREP (&VAR1A.LENGTH, &VAR1A, 5, 'huge', 1, '8', &VAR1.LENGTH, 'A&VAR1.LENGTH');
-SET &VAR1A =
- STRREP (&VAR1A.LENGTH, &VAR1A, 1, '|', 1, ',', &VAR1.LENGTH, 'A&VAR1.LENGTH');
-TYPE &VAR1
-TYPE &VAR1A
-*STRREP (inlength, instring, searchlength, searchstring, replength, repstring, outlength, outstring)
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
February 11, 2014, 10:08 AM
Joel ElscottPerfect! Thanks Francis!