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

Is string all caps? 1

Status
Not open for further replies.
Sep 8, 2005
54
0
0
US
Using Crystal 10 connecting to MS SQL 2000 via ODBC.

I am trying to find out if the value of a field is all caps. I was hoping the following formula would work, but it returns 1 with an o3_name of '275 Main St.'

Code:
if {SiteAddress.o3_name} = uppercase({SiteAddress.o3_name})
    then 1
    else 2

Apparently, uppercase (& lowercase) don't make a difference in comparisons. Any suggestions???

thanks,
damon
 
I think that you're mistaken, try this formula:

if "hello there" = "HELLO THERE" then
1
else
2

You'll get a 2.

You may need to select the File->Report Options->Database is case sensitive.

-k
 
Hi,
I cannot reproduce that problem ( I use Oracle but it should not make a difference, but..)
Any test I try returns the correct value..

Be sure to test for Nulls first, just in case ( no pun intended)



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Using synapse's test formula, I returned a '1' until I unchecked File->Report Options->Database Server is Case-Insensitive.

cheers,
damon
 
You can also make the comparison while keeping Case-Insensistivity for normal searches. I had something similar with e-mails, trying to sort which were upper-cases. First I used LowerCase({@E_Mail}) to convert. Then

Code:
 ASC(Left({@E_Mail}, 1)) = ASC(Left({@LowCase_Mail}, 1))
and
ASC(Mid({@E_Mail}, 2, 1)) = ASC(Mid({@LowCase_Mail}, 2, 1))

It only works on single characters, unfortunately. So when the (boolian) test is false, I assume upper-case or title-case. I also assumed that there would not be any strAy upper-case, which was safe enough with this data. You could extend the tests if needed.

[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