on 05-11-2010 5:55 PM
I wrote a report using parameters for selecting data to be displayed in the report.
One parameter is StudentID, which is 9 numeric characters as a string. As a user data entry validation, I set both Max Length and Min Length of StudentID to 9.
Student ID most reliably pins down a student. However, users using the report may sometimes do not know a student's ID, so I provide the Firstname and Lastname parameters as an alternative.
In the Select Expert, the code is:
(
{FIRST_NAME} = UpperCase({?Firstname}) and
{LAST_NAME} = UpperCase({?Lastname})
) OR
{STUDENT_ID} = {?StudentID}
When run the report, the report runs OK if only student ID is entered and first name and last name are left blank. However, if first name and last name are entered and student ID is left blank, the report won't let you go, and says the minimum length for this field is 9. The report won't run until you have entered 9 digits in addition to first and last names.
I found that I can get around this by removing the settings of Min Length and Max Length are removed. But that also gives up user entry validation.
What it appears to me is that Crystal Report checks ID length without bother to see the OR there. What my data selection code expects of it is to be aware of the OR first and check ID length only when necessary.
Or is there a way to get around this, and get to select data either by name or by ID, and still get the ID length validated when ID is used for data selection? (I am using Crystal Report Version 11.)
Thanks for help!
Newman
Set a default Student ID of 000000000 or ----
HTH,
Jason
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jason:
Thank you for the suggestion. I tried. But the problem remains.
Under Value Options for the StudentID paramter editing, a few lines up above Max Length and Min Length is the Default Value. I set it to 000000000, saved and closed the report, and then restarted the report. Tried entering first name and last name and leaving student ID blank. And it still complains that Minimum length must be 9.
Newman
Make sure you aren't saving the preview when you save the report. If you save the preview, it will also save your last parameter entry. Close the the preview by clicking the X on the tab and save the design only. Now retry...
If you;re still having problems, double check your parameter and make sure it's save correctly. The default should appear pre-populated when the prompt is displayed.
Jason
Jason,
The problem is solved. I am new and did not know there was a difference between saving changes in design and in preview. It's cool! Now the report behaves the way you described, with 000000000 pre-populated in the StudentID parameter box.
Thank you very much for your help!
Newman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.