Character Replacement

Edis, Bob bob.edis@fleetpride.com
Tue, 27 Feb 2001 14:45:49 -0600


John

Unfortunately the world is not perfect and everybody doesn't use Quick to
enter data.  Even if they did, it's impossible to create a pattern for every
possible variance.

For example, we have users entering a part number at different locations via
a packaged program written in BASIC.  The part_number is a CHAR field with
not constraints as there is no master parts list to validate against when
entering a part number.  The SAME part number may be entered at different
branches within the same system and is the vendor supplied part number.  The
user enters the part number as they like it, e.g. with dashes, spaces, etc
to make it 'easier' to read on screen.  However when I have to consolidate
these part numbers in a central database I must strip out these extraneous
characters so the part number is the same no matter where and by whom it was
entered.  

In T-SQL I can do this easily with the REPLACE() function BUT I CAN'T DO IT
IN PowerHouse!  I wish there was a good SUBSTITUTE(item,P1,P2) function in
the PowerHouse syntax.

Blue

-----Original Message-----
From: Pickering, John (NORBORD) [mailto:PICKERIJ@norbord.com]
Sent: Tuesday, February 27, 2001 2:19 PM
To: 'Bill D Michael'; powerh-l@sphere.swau.edu
Subject: RE: Character Replacement


You indicate that the source of the problem is Quick. So first stop letting
the users enter the junk which causes the problems. In Quick you could add a
pattern to the field statement limiting the allowable entries or loop
through the field using a "FOR ii" where ii is the length of the item
removing the offending characters with your INDEX and [] suggestion.

Now you have reduced the Qtp task to a one time fix. So who cares if you
have to pass through the data "two or twenty" times? Maybe look for half a
dozen problem characters at a time. Pass through the file until you don't
find anything to fix. Remember it's a one time fix!

Regards,
JWP

> -----Original Message-----
> From:	Bill D Michael [SMTP:Bill.Michael@ipaper.com]
> Sent:	Tuesday, February 27, 2001 2:14 PM
> To:	powerh-l@sphere.swau.edu
> Subject:	Character Replacement
> 
> Looking for a way in QTP (or Quiz) to replace all occurances of a single
> character in a field with another character - for example, the record
> might
> contain "---- this is a test ----", and I want to update it to contain "
> ==== this is a test ====". Primarily because we have users entering
> "illegal" characters into text fields on Quick screens that cause problems
> much later, such as quotes, slashes, and @ signs.
> 
> The manual refers to a "substitution character", ^, but I believe this is
> only for error messages and such and can't be used for what I want here. I
> can replace a single occurrance using INDEX and the [] syntax, but since
> there could be two or twenty, I'd have to run "n" requests to accomplish
> the whole thing.
> 
> Bill
> 
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
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.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
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.