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!

Finding all records by checking if a field is in caps

Status
Not open for further replies.

demchak

IS-IT--Management
Jun 29, 2001
36
US
I am trying to so a selection function that will show me any records where one field in paticular is in all caps. I tried to use the selection criteria

trim({NAME.CADD1}) = Ucase(trim({NAME.CADD1}))

But the = seems to show just where the letters are equal regardles of the case.
Could someone please let me know if there is a different compare or better way to do this.
Thanks
 
Have you turned off the Case-insensitive SQL option? It is under File , options or use File Report Options, if you only want to turn it off for this report Mike

 
It unchecked it but still get the same results. Any other ideas?

WH
 
If you have CR 8 or higher the following will work;

Create the following formula:
Code:
stringvar check; 
local numbervar loop; 
local numbervar lngth;
local numbervar caps;

check:=trim({NAME.CADD1}) ;
lngth:=length(check);

for loop:=1 to lngth do (


if asc(check[loop]) in 65 to 91 then caps:=caps+1

);
lngth=caps

This line if asc(check[loop]) in 65 to 91 then caps:=caps+1 check the ascii value of each character to see if it is between 65 (A) and 91 (Z)

The result is either True (if all caps) or False if not. It will return False if any numbers. If there are spaces, change the ine to:
Code:
asc(check[loop]) in [65 to 91,32] then caps:=caps+1
Mike

 
You could try inverting your uppercase check too.

I spent some time with a similar problem, and Rosemary suggested the following, which seemed to do the trick.

Uppercase(trim({NAME.CADD1})) = trim({NAME.CADD1})

Naith
 
"StrComp(trim({NAME.CADD1}), Ucase(trim({NAME.CADD1})), 0)" will return 0 if {NAME.CADD1} is all caps or a positive integer showing the position of the first lower-case letter otherwise. The third parameter of 0 specifies a binary (case-sensitive) comparison. This function is available in CR 8.x but maybe not in earlier versions.
 
< trim({NAME.CADD1}) = Ucase(trim({NAME.CADD1})) >


it couldn't be something simple like using the above formula in Crystal syntax....if it is crystal syntax it should be

trim({NAME.CADD1}) = Uppercase(trim({NAME.CADD1})) Jim Broadbent
 
I would try writing a formula field with the expression:

trim({NAME.CADD1}) = Uppercase(trim({NAME.CADD1}))

Then put that field in your select expert. This should force the comparison to happen within CR and formula literals in CR are always case sensitive. Not even sure that you need to Trim() them. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top