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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

uppercase 2

Status
Not open for further replies.

lvadmin

MIS
May 5, 2004
28
US
I need to import data from test2.dbf into test.dbf. The structure in these 2 .dbf files are identicle. The question is "How do I import test2.dbf into test.dbf making sure that everthing in test.dbf is uppercase? And everything that was lowercase was changed to uppercase?"

Thanks much

Ross
 


Check UPPER() in the help file.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Right, I see it in the help file but I'm still a bit confused...

append from test1.dbf ?(upper)

is this the proper command?

or

? (upper) append from test1.dbf

....????
 
Actually, APPEND and IMPORT dont give you much flexibility in changing the data on the way in. You'd either need to change the data in the TEST1.DBF, or fix it after you do the APPEND.

For the first case, just do a REPLACE ALL on all the fields you want to uppercase. e.g.
Code:
SELECT TEST1
REPLACE ALL ;
  LNAME with UPPER(LNAME),;
  FNAME with UPPER(FNAME),;
  ADDRESS with UPPER(ADDRESS)
USE in TEST1
SELECT TEST
APPEND FROM TEST1
Obviously you'll need to change the required field names and add as many as you need.

In the second case just do:
Code:
SELECT TEST
APPEND FROM TEST1
* Fix All the data - old and new!
REPLACE ALL ;
  LNAME with UPPER(LNAME),;
  FNAME with UPPER(FNAME),;
  ADDRESS with UPPER(ADDRESS)
Rick
 
Hi,

If you have too many fields and don't want to type a lot, try this:
Code:
USE TEST
APPEND FROM TEST1
SCAN
  FOR F=1 TO FCOUNT()
      IF TYPE(FIELD(F))="C"
         REPLACE (FIELD(f)) WITH ;
         UPPER(EVAL(FIELD(F)))
      ENDIF
  ENDFOR
ENDSCAN

It does the same, but Rick's solution is easier to understand.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top