This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C156F2.085447A0 Content-Type: text/plain; charset="iso-8859-1" RE: Can any one suggest how to convert commas in a string into another character in QTP ? if you have qtp you probably have qdesign, so you could try something like the following ( I have not parsed this code so it probably contains many syntax errors ), assuming a field of string length of n, screen docomms file fcomms desig file fcomms desig alias out-rec open 2 temp t'comms char*n reset at startup proc internal nloop begin for n begin if "," = fcomms-field of fcomms [occurence:1] then let t'comms = truncate ( t'comms ) + "|" ; or some other char else let t'comms = truncate ( t'comms ) + fcomms-field [occurence:1] end get out-rec using fcomms-key of fcomms let fcomms-field of out-rec = t'comms put out-rec reset end proc initial begin while ret fcomms seq begin if 0.5 lt index ( fcomms-field , "," ) then do internal nloop end return end -----Original Message----- From: Ole Hansen, ScanConsult [mailto:oh@scanconsult.dk] Sent: 17 October 2001 10:16 To: Chris Sharman; Lemin, Graeme; powerh-l@lists.swau.edu Subject: Sv: Converting string characters in QTP String substitutions are nasty in PowerHouse and as demonstrated ecpecially nasty in QTP/QUIZ, so maybe we should take the opportunity to ask Cognos to consider a new function in PowerHouse, e.g. REPLACE(original-string,search-string,replace-string) When we had a similar problem (with Danish special characters), we made a subfile and converted its records with a Pascal program, and accessed the converted subfile from QUIZ. The whole 3-stage process was put in a jobfile and executed on-line. /Ole Hansen ==================================================================== E-mail: oh@scanconsult.dk Cell Phone: +45 40 40 11 50 ==================================================================== ScanConsult IT-Partners ApS Voice : +45 87 38 74 74 Jegstrupvej 96A Fax : +45 87 38 74 75 DK-8361 Hasselager Support : support@scanconsult.dk Denmark Sales : sales@scanconsult.dk http://www.scanconsult.dk === ParaSuite : A Suite of Air Cargo Handling solutions === === ParaSafe : A Suite of IT-Security solutions === === We partner with Hewlett-Packard, Cognos, Lotus and others === -----Oprindelig meddelelse----- Fra: Chris Sharman <chris.sharman@ccagroup.co.uk> Til: Lemin, Graeme <graeme.lemin@team.telstra.com>; powerh-l@lists.swau.edu <powerh-l@lists.swau.edu> Dato: 17. oktober 2001 10:05 Emne: RE: Converting string characters in QTP > > >> Can any one suggest how to convert commas in a string into another >>character in QTP? > >No easy way. >If the goal is to remove embedded commas to create a csv, you can enclose >the string in quotes (although then you have the same problem with the >quotes). > >In Powerhouse: > >; assuming a length of 80, substituting ";" for "," >def i1 int*4 = index(original, ",") >def str1 char*80 = original if (i1=0) else original[1:i1 - >1]+";"+original[i1+1:80 - i1] >; 1st taken care of ... >def i2 int*4 = 0 if (i1=0) else index(str1,",") >def str2 char*80 = str1 if (i2=0) else str1[1:i2 - 1]+";"+str1[i2+1:80 - i2] >; 2nd taken care of ... >def i3 int*4 = 0 if (i2=0) else index(str2,",") >def str3 char*80 = str2 if (i3=0) else str2[1:i3 - 1]+";"+str2[i3+1:80 - i3] >; 3rd taken care of ... >; continue as long as seems necessary. > >Note that this is quite inefficient: >i1 is evaluated 4 times in the evaluation of str1, 5 in the evaluation of i2 >(if there's a comma). >Similarly i2 and i3. >For this reason you may get better performance doing multiple passes, >removing 1, or a few, commas each time, rather than trying to remove a large >number of commas in one pass. > >Alternatively, you could use TPU (on VMS) or perl, or some similar tool. > >Chris > > > >----------------------------------------------------------------------- > >Any views expressed in this message are those of the sender and not >necessarily those of CCA Group. The unauthorized use, disclosure, >copying or alteration of this message is forbidden. The contents of >this message may be confidential and/or privileged, copyright CCA Group >and are intended solely for the use of the individual or entity to whom >they are addressed. Whilst this message has been scanned, CCA Group >cannot guarantee that it is virus free or compatible with your systems >and accepts no responsibility for any loss or damage arising from its >use. The recipient is advised to run their own anti-virus software. If >you receive this message in error please contact >postmaster@ccagroup.co.uk immediately, destroy any copies and delete it >from your computer systems. > >= = = = = = = = = = = = = = = = = = = = = = = = = = = = >Mailing list: powerh-l@lists.swau.edu >Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu >Unsubscribe: "unsubscribe" in message body to powerh-l-request@lists.swau.edu >http://lists.swau.edu/mailman/listinfo/powerh-l >This list is closed, thus to post to the list you must be a subscriber. > = = = = = = = = = = = = = = = = = = = = = = = = = = = = Mailing list: powerh-l@lists.swau.edu Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu Unsubscribe: "unsubscribe" in message body to powerh-l-request@lists.swau.edu http://lists.swau.edu/mailman/listinfo/powerh-l This list is closed, thus to post to the list you must be a subscriber. ------_=_NextPart_001_01C156F2.085447A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">RE: Converting string characters in QTP RE: Can any one suggest how to convert commas in a = string into another character in QTP ?
if you have qtp you probably have qdesign, so you = could try something like the following ( I have not parsed this code so = it probably contains many syntax errors ),
assuming a field of string length of n,
screen docomms
file fcomms desig
file fcomms desig alias out-rec open 2
temp t'comms char*n reset at startupproc internal nloop
begin
for n
begin
if = "," =3D fcomms-field of fcomms [occurence:1]
&nb= sp; then let t'comms =3D truncate ( t'comms ) + "|" ; or some = other char
&nb= sp; else
&nb= sp; let t'comms =3D truncate ( t'comms ) + fcomms-field = [occurence:1]
endget out-rec using fcomms-key of fcomms
let fcomms-field of out-rec =3D t'comms =
put out-rec resetend
proc initial
beginwhile ret fcomms seq
begin
if 0.5 lt index ( fcomms-field , = "," )
then do = internal nloop
endreturn
end
-----Original Message-----
From: Ole Hansen, ScanConsult [mailto:oh@scanconsult.dk]
Sent: 17 October 2001 10:16
To: Chris Sharman; Lemin, Graeme; = powerh-l@lists.swau.edu
Subject: Sv: Converting string characters in = QTP
String substitutions are nasty in PowerHouse and as = demonstrated ecpecially nasty in QTP/QUIZ, so maybe we should take the = opportunity to ask Cognos to consider a new function in PowerHouse, = e.g.
REPLACE(original-string,search-string,replace-string)
When we had a similar problem (with Danish special = characters), we made a subfile and converted its records with a Pascal = program, and accessed the converted subfile from QUIZ. The whole = 3-stage process was put in a jobfile and executed on-line.
/Ole Hansen
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
E-mail: = oh@scanconsult.dk &= nbsp; Cell Phone: +45 40 40 11 50
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
ScanConsult IT-Partners = ApS &nb= sp; Voice : +45 87 38 74 74
Jegstrupvej = 96A &nb= sp; &nb= sp; Fax : +45 87 38 74 = 75
DK-8361 = Hasselager &n= bsp; Support : = support@scanconsult.dk
Denmark &n= bsp; &n= bsp; Sales = : sales@scanconsult.dk
&nb= sp; http://www.scanconsult.dk
=3D=3D=3D ParaSuite : = A Suite of Air Cargo Handling solutions = =3D=3D=3D
=3D=3D=3D ParaSafe = : A Suite of IT-Security = solutions &nb= sp; =3D=3D=3D
=3D=3D=3D We partner with = Hewlett-Packard, Cognos, Lotus and others =3D=3D=3D-----Oprindelig meddelelse-----
Fra: Chris Sharman = <chris.sharman@ccagroup.co.uk>
Til: Lemin, Graeme = <graeme.lemin@team.telstra.com>; powerh-l@lists.swau.edu = <powerh-l@lists.swau.edu>
Dato: 17. oktober 2001 10:05
Emne: RE: Converting string characters in QTP
>
>
>> Can any one suggest how to convert commas = in a string into another
>>character in QTP?
>
>No easy way.
>If the goal is to remove embedded commas to = create a csv, you can enclose
>the string in quotes (although then you have the = same problem with the
>quotes).
>
>In Powerhouse:
>
>; assuming a length of 80, substituting = ";" for ","
>def i1 int*4 =3D index(original, = ",")
>def str1 char*80 =3D original if (i1=3D0) else = original[1:i1 -
>1]+";"+original[i1+1:80 - i1]
>; 1st taken care of ...
>def i2 int*4 =3D 0 if (i1=3D0) else = index(str1,",")
>def str2 char*80 =3D str1 if (i2=3D0) else = str1[1:i2 - 1]+";"+str1[i2+1:80 - i2]
>; 2nd taken care of ...
>def i3 int*4 =3D 0 if (i2=3D0) else = index(str2,",")
>def str3 char*80 =3D str2 if (i3=3D0) else = str2[1:i3 - 1]+";"+str2[i3+1:80 - i3]
>; 3rd taken care of ...
>; continue as long as seems necessary.
>
>Note that this is quite inefficient:
>i1 is evaluated 4 times in the evaluation of = str1, 5 in the evaluation of i2
>(if there's a comma).
>Similarly i2 and i3.
>For this reason you may get better performance = doing multiple passes,
>removing 1, or a few, commas each time, rather = than trying to remove a large
>number of commas in one pass.
>
>Alternatively, you could use TPU (on VMS) or = perl, or some similar tool.
>
>Chris
>
>
>
>-----------------------------------------------------------= ------------
>
>Any views expressed in this message are those of = the sender and not
>necessarily those of CCA Group. The = unauthorized use, disclosure,
>copying or alteration of this message is = forbidden. The contents of
>this message may be confidential and/or = privileged, copyright CCA Group
>and are intended solely for the use of the = individual or entity to whom
>they are addressed. Whilst this message = has been scanned, CCA Group
>cannot guarantee that it is virus free or = compatible with your systems
>and accepts no responsibility for any loss or = damage arising from its
>use. The recipient is advised to run their own = anti-virus software. If
>you receive this message in error please = contact
>postmaster@ccagroup.co.uk immediately, destroy = any copies and delete it
>from your computer systems.
>
>=3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D = =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D
>Mailing list: powerh-l@lists.swau.edu
>Subscribe: "subscribe" in message body = to powerh-l-request@lists.swau.edu
>Unsubscribe: "unsubscribe" in message = body to powerh-l-request@lists.swau.edu
>http://lists.swau.edu/mailman/listinfo/powerh-l
>This list is closed, thus to post to the list = you must be a subscriber.
>
=3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D = =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D
------_=_NextPart_001_01C156F2.085447A0--
Mailing list: powerh-l@lists.swau.edu
Subscribe: "subscribe" in message body to = powerh-l-request@lists.swau.edu
Unsubscribe: "unsubscribe" in message body = to powerh-l-request@lists.swau.edu
http://lists.swau.edu/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you = must be a subscriber.