Parsing a "csv" file in QTP

george.j.wen@us.abb.com george.j.wen@us.abb.com
Mon, 25 Sep 2000 08:36:26 -0500



Richard,

I've done this many times.  I have a program squired away somewhere that
I can send you  if you like but the gist of is to use indexing.  You DO NOT want
to use QTP!  Processing time can become prohibitive because you need a
number of defines to do this.

What you do is define each record as a field first, call it element WHOLE-REC.
Then you index for the first delimiter which may be a comma or if enclosed in
quotes you'll end up with {","}  -  quote comma quote between each field.  In
case it's like this:

define I1 = index (WHOLE-REC, ",")    - searching for the comma in this case
define FIELD-1 = WHOLE-REC[1:I1 - 1]

now you must define the remainder of what's left in whole rec that you've not
yet processed:

define WHOLE-REC2 = WHOLE-REC[I1 + 1:500 - I1]  -  now you have everything
that's left but the 1st field.

now repeat the process for the number of elements you have.  It works great.  If
this isn't enough to go on let me know.


George


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.