Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to remove with changeto query? 1

Status
Not open for further replies.

jlockley

Technical User
Nov 28, 2001
1,522
US
I am using Paradox to bring three phone books with many duplicates together. One of the programs has put a ' at the beginning of a number of records.

I would like to remove it with a changeto query.
',changeto "" isn't doing it. Where is my syntax amiss?
(The goal would be to have the name 'Jones appeaer as Jones.) Since I need to key for duplicates, I can't have a space or other character.

Gracious thanks to all. JLL
 
Well, it all happened when my boss came up and said "You're in the wrong business, Bob, I can't find someone to teach a VB class for less than (3 or 4 times what I was making at the time) a day. A few months later, I got my MCT.

The point about VB is that its vagaries and inconsistencies allow people that can work around those to charge extra money for their time. If you can implement a good OO design in VB, you're a pretty rare bird.

But I'd like to get back into the Paradox world again sometime.

Bob
 
I think the original post was . . .

"I am using Paradox to bring three phone books with many duplicates together. One of the programs has put a ' at the beginning of a number of records.

I would like to remove it . . . "

It's not a query but how about this;

tc.edit()
scan tc:
str=tc."FIELD004".value ;field name in table
str.breakApart(ar, "$:,") ;remove the offending 3 characters
si=ar.size() ;return number of elements in string
endscan
tc.close()
Message("Processing Record No. ", tc.recno())

Works for me.

Rick
 
<but you can't use a QBE query to tell Paradox to leave everything but that character (or any other) in the field.

Tony, I wonder if

\'.., changeto ..

works? I seem to remember doing something like this.

Bob
 
No, Bob, unfortunately it doesn't.

As I said, though, SQL has a syntax that will do it.


Rick, there's a simpler syntax:
Code:
; if you know there's only one:
breakapart(tc."fieldname",arBreak,"'")
tc."fieldname"=arBreak[2]
OR, if you want to break/filter multiple characters:
Code:
breakapart(tc."fieldname",arBreak,"'#$%")
tc."fieldname=arBreak[1]
if arBreak.size()>1 then
  for x from 2 to arBreak.size()
    tc."fieldname"=tc."fieldname"+arBreak[x]
  endfor
endif

I used the substr() version because I wanted to help answer the specific request. Without clouding things right off the bat.





Tony McGuire
"It's not about having enough time. It's about priorities.
 
What if the ' is at the beginning of the field?
Would that still work?
 
Who are you asking, and what is 'that' in the 'would that still work'?

If you mean my breakapart, yes it would.

Rick's mostly does, except it doesn't put things back together; which has to happen within the scan...endscan in order to affect the same record the data came from.

And the message("") OUTSIDE the scan doesn't click (or work since you've already closed the tc prior to trying to use it in the message()) - what is that for?

No, Bob. The '..' can't be referenced/used in the result request.

Tony McGuire
"It's not about having enough time. It's about priorities.
 
; if you know there's only one:
breakapart(tc."fieldname",arBreak,"'")
tc."fieldname"=arBreak[2]
 
; if you know there's only one:
breakapart(tc."fieldname",arBreak,"'")
tc."fieldname"=arBreak[2]


Yes, that would work.

But be forwarned - if any of the data also has an apostrophe, you'll wind up throwing out everything to the right of it.

Tony McGuire
"It's not about having enough time. It's about priorities.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top