TechTricks
Technical answers from the trenches 
 
 
 
 

     
   
Converting Field Values to Upper Case
 
   
 Posted: 1 October 2000
 
   
 
 Applies to: Paradox 5.0 and later
 
   
 
Audience: Everyone
 
       
   

Question: How do I convert my existing field values to upper case?

Answer: There are several ways you can do this. Here are two:

The following SQL query uses the Customer sample table provided with most versions of Paradox. In this case, it converts the values in the Name field to upper-case:

   UPDATE
      "CUSTOMER.DB"
   SET
      Name = upper( Name )

If you've not used SQL queries, you may wish to consider experimenting with the possibilities they offer. SQL queries can often perform tasks beyond the scope of QBE queries. For more information about what's available, see the LOCALSQL.HLP file in your BDE directory, typically c:\Program Files\Borland\Common Files\BDE.

If you do not have LOCALSQL.HLP, a copy is available in our Downloads section.

You can also convert field values using ObjectPAL. For example, the following code shows how you might accomplish the above task from a button's pushButton event():

method pushButton( var eventinfo Event )
var
   tc  tCursor
endVar

   ; Please note that you should add appropriate error checking.
   tc.open( "CUSTOMER" )
   tc.edit()
   scan tc :
      tc.Name = upper( tc.Name )
   endScan
   tc.close()

endMethod

Either approach will work fine; use the one that appeals to you.

For best long-term results, it's better to have values converted to upper case when the data is entered into the table. For more information, see "Saving Values in Upper Case"

 

       

Top

Feedback About Paradox Delphi Assorted Web Stuff
 
 
Copyright © 2000-2004, techtricks.com; All Rights Reserved.
Acknowledgements, Disclaimers, Terms and Conditions.
Article last updated on 01 June 2003

 

Other Sites: Paradox, Delphi, Perl, Web Stuff, and More


 

[- End -]