Focal Point
Issue with CTRAN

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

October 09, 2007, 11:55 AM
<Navin>
Issue with CTRAN
Hi

I am trying to replace the single quotes with an escape character.

i Have two issues.

* The resultant string gets trimmed off once the length of the original string is more than 15.
* when the original string length is 3 or less , additional characters are getting apended to it .

Is there any way i can solve the issue.

Thank
Naveen.
WF 7.1.6
October 09, 2007, 11:57 AM
GinnyJakes
Can you post your code and the before and after results, please?

That will make it easier for us to help you.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 09, 2007, 12:27 PM
<Navin>
ya sure ,

read as

'original string'(&tmp)---'length of the original string'(&TL)---'translated string'

'ACCOUNT MNEMONIC'---'16'---'ACCOUNT MNEMONIC ';
'ADD2*'---'05'---'ADD2* ';
'BANK ACCOUNT NUMBER'---'19'---'BANK ACCOUNT NUMB';
'DDA'---'03'---'DDAL ';
'INVESTMENT HORIZON*'---'19'---'INVESTMENT HORIZO';
'MASTER MNEMONIC*'---'16'---'MASTER MNEMONIC* ';
'OWNERS INV EXP*'---'15'---'OWNERS INV EXP* ';

the code i use is ,

-SET &TEMPBUFF.&CT = CTRAN(&TL,&TMP,39,27,A&TL);

TL has the length of the string.
TMP is the original string
TEMPBUFF is an array

Thanks
Naveen.
WF 7.1.6
October 09, 2007, 12:42 PM
N.Selph
Is the lack of single quotes around the format a typo?
  
-SET &TEMPBUFF.&CT = CTRAN(&TL,&TMP,39,27,'A&TL');



(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
October 09, 2007, 12:53 PM
Francis Mariani
-SET &TMP1 = 'ACCOUNT MNEMONIC';
-SET &TMP2 = 'ADD2*';
-SET &TMP3 = 'BANK ACCOUNT NUMBER';
-SET &TMP4 = 'DDA';
-SET &TMP5 = 'INVESTMENT HORIZON*';
-SET &TMP6 = 'MASTER MNEMONIC*';
-SET &TMP7 = 'OWNERS INV EXP*';
-SET &TMP8 = 'OWNER''S INV EXP*';

-REPEAT ENDREP1 FOR &CT FROM 1 TO 8 STEP 1

-SET &TEMPBUFF.&CT = CTRAN(&TMP.&CT.LENGTH, &TMP.&CT, 39, 27, 'A&TMP.&CT.LENGTH');

-TYPE
-TYPE &CT : &TMP.&CT - &TEMPBUFF.&CT
-TYPE
-ENDREP1


RESULTS IN:

 
 1 : ACCOUNT MNEMONIC - ACCOUNT MNEMONIC
 2 : ADD2* - ADD2*
 3 : BANK ACCOUNT NUMBER - BANK ACCOUNT NUMBER
 4 : DDA - DDA
 5 : INVESTMENT HORIZON* - INVESTMENT HORIZON*
 6 : MASTER MNEMONIC* - MASTER MNEMONIC*
 7 : OWNERS INV EXP* - OWNERS INV EXP*
 8 : OWNER'S INV EXP* - OWNERS INV EXP*


What "escape character" are you using? Are there really any single quotes in the input? What platform are you running this on?


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 09, 2007, 12:58 PM
hammo1j
Its the lack of a .EVAL thats the problem

-SET &TEMPBUFF.&CT = CTRAN(&TL,&TMP,39,27,A&TL.EVAL);

I find this better syntax - much less to remember

-* initialise replacement to same length as original
-SET &TMPNEW = &TMP ;
-SET &TEMPBUFF.&CT = CTRAN(&TMPNEW.LENGTH,&TMPNEW,39,27,&TMPNEW);



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
October 09, 2007, 01:52 PM
<Navin>
Thanks hammo1j

EVAL was the one that was missing . . That works fine now . .

Francis,

Actually while posting , the whitespaces at the end of all the translated string got cut off.

Thanks
Naveen.