Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need new UDF strreplace
Message
From
09/05/2007 13:24:50
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
09/05/2007 13:15:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01223626
Message ID:
01223891
Views:
15
>>>>Thanks, but I don't think so. :) It's got to be positional. That would overwrite every occurance of that value throughout the string, no?
>>>>
>>>>Given a string with a specified delimiter
>>>>
>>>>ISA*00*00*ZZ*TEST^
>>>>
>>>>remove the ZZ and replace it with MY. It's in the 4th "field" position.
>>>>
>>>>Thanks!
>>>
>>>Hi Mike,
>>>
>>>Most well-formed EDI documents are (or can be) one long string, so I'm not sure what you are asking for is doable.
>>>
>>>If you break up the transactions into segments it might be possible, but I don't think there is a 'generic' solution. I would guess that you typically need to know what Loop/Segment you are dealing with.
>>
>>Yes, each segment would be treated as a "record". The ISA line has preset field "positions".
>>
>
>When dealing with elements by position, I typically call ALINSE() to break up the document into segments, then ALINES() again on segments of interest (and ALINES() again if a need a sub-element).

I've found I get the best performance by pulling a text file into a cursor and processing it with scan/replace.

I'd have to use alines to grab the elements, replace one element and undo the alines back to the string before writing it back to the field.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform