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

Formatting an address field

Status
Not open for further replies.

munchen

Technical User
Aug 24, 2004
306
GB
I am using Crystal 8.5.

I have an address field called address1 that displays data like so:

10 NEW ROAD

What I need to do is display the address field like so:

10 New Road

Is it possible to display the address field like this?
 
Yes. Use SPLIT to separate the words. Use LOWERCASE to change and then UPPERCASE(LEFT(@someword, 1) to convert back the first letter.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Madawc

I have created a formula called @Address that has the following split function in it.

Local StringVar str;
Local StringVar Array add;
Local StringVar address1:="";
Local NumberVar n;

str := {tblTest.Address1};
add := Split(str," ", n+1);

If Ubound(add) > n then
address1 := add[Ubound(add)];
address1;

How do I set the results of this array to have the first letters in uppercase and the remaining letters in lowercase?
 
Treat the elements as separate fields, Split({address1}, " ")[1] and so on.

For your example, 10 NEW ROAD, "10" would be element [1], "NEW" would be element [2], "ROAD" would be element [3] and element [4] would be null. Put them in formula fields and adjust them there. Remember that formulas stop when they hit a null, unless ISNULL is used to test.

You can also use UBOUND to find the number of table elements.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top