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

Force Uppercare

Status
Not open for further replies.

MillerXJ

Programmer
Apr 9, 2007
6
US
I have a parameter field under last name. In my database, all last names are uppercase. How would I go about forcing my parameter field to be uppercase, even if the user enters it in lowercase.

I have tried the edit mask and entering in >CCCCCCCC.... but that will not work on the first entry.
 
try:
table.lastname in UpperCase(?lastname)
or
table.lastname = UpperCase(?lastname)

depends on if you allow multiple/single values in your last name parameter
 
I tried that before and got:

This array must be subscripted. For example: Array.
 
What CR version are you using? Anyway, you could use the following, although it will not pass to the SQL:

numbervar i;
numbervar j := ubound({?lastname});
stringvar x;

for i := 1 to j do(
if {table.name} = ucase({?lastname}) then
x := x + table.name}
);
{table.name} in x

Alternatively, if users always chose the same number of names, you could use:

(
{table.name} = ucase({?lastname}[1]) or
{table.name} = ucase({?lastname}[2]) or
{table.name} = ucase({?lastname}[3])
)

...and this should pass to the SQL statement.

-LB

 
Try:

numbervar counter;
numbervar A := ubound({?lastname});
stringvar array MyArray;
redim MyArray[1];
for counter := 1 to A do(
redim preserve MyArray[counter];
MyArray[counter] := ucase({?lastname}[counter])
);
{table.name} in MyArray

Note under File->Options->Database there's an option fordatabase is caseinsensitive.

Please include basic technical info with your posts; Crystal version, database.

-k
 
Both of those suggestions return a True of False value back.

How would you set up your parameter field to look at the actual uppercase values?

I am currently utilizing Crystal 9 and CE 9, DB2 ODBC Database.



 
These formulas are record selection formulas, not formulas for displaying the parameter selections, which is why they return true or false. They belong in report->selection formula->record.

To display the parameter selections, you could just use:

join({?lastname},", ")

-LB
 
The edit mask sort of works. If I do a >??????? and run the report for say last name = Smith, the report will run the report on SMITH__. With the last 2 characters as who knows what.

After the initial adding of SMITH__, I can then add SMITH, JONES, MILLER etc and get the report to run.

So why does the first parameter look at all 7 characters, but the rest do not?
 
Miller: Relax and answer questions posed of you, both LB's and my solution work fine and are common, you are just placing the code in the wrong place.

Go to Report->Selection Formula->Record and place the formula in there.

-k
 
synapsevampire,

I have placed your code in Report->Selection Formula->Record.

I then went in and took out the edit mask I had in place, ran the report, and it is returning no values.

What could I be doing wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top