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

Importing Pick List File for Parameter Fields

Status
Not open for further replies.

dbew

MIS
Sep 18, 2002
49
US
Hi everyone,

I had a question in regards to Crystal Reports (Version 8.5) and its ability to import a Pick List File when creating parameter fields.

In Notepad, I create a file that contains numbers that represent the states and then the state name. For example:

01 Alabama
02 Alaska,
03 Arizona
04 Arkansas

When I choose to create a parameter field in the “Create Parameter Field” window, I need to choose “Number” as my Value type. I proceed to enter the Parameter field name and prompting text, and I set the default values by importing the pick list file. I finally add the parameter field to the selection formula.

Now when I decide to refresh the report, the pick list values appear but like so:

1.00 - Alabama
2.00 - Alaska
3.00 - Arizona
4.00 - Arkansas


Does anyone know of a way to change the 1.00 to 01, the 2.00 to 02, and so on. Changing the value type to “String” does not work as I get an error message indicating “A number range is required here.”

Please help!!!

Thanks,
dbew
 
Sounds like your parameter has to be a number because you are using it in the select expert against a numeric field. What is your selection formula? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
It is not clear why you "need" to define
it as a number. You can always define it as a String and take care of the conversion in your record selection expression.

You can turn off the display of the number alltogether by going to the default values dialog for the parameter and select the Description Only option for what gets displayed.

You can even insert the number also as part of the Description portion to make it appear as if it's both parts.

hth,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
The big problem is that 01 is not a number.

Picklists are pretty weak in CR, and you can't format them in the picklist.

Is there an advantage to showing the 01, 02, etc?

I would display only the State name

Create a number type parameter using a file with the following structure and it should work fine for you:

%%%%ShowDescOnly 1
1.00 Alabama
2.00 Arkansas
etc...

This will only display the Description, and not the integer that I assume you use in the record selection formula.

Now you can reference the parameter in your record selection formula as follows:

{MyTable.MyStateID} = {?states}

and it will pass the SQL to the database, allowing for a nice State picklist, and optimal performance from the database as the values are passed.

-k kai@informeddatadecisions.com
 
Thank you to everyone that replied to my initial post. I decided to take IdoMillet’s advice and “insert the number also as part of the Description portion to make it appear as if it's both parts” and then display just the description only.

Now the parameter lists the values as the way I prefer: 01-Alabama, 02-Alaska, etc.

THANK YOU AGAIN TO EVERYONE!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top