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!

Multiple Range(s) as Parameter 1

Status
Not open for further replies.

DerbyNeal

Programmer
May 12, 2005
22
0
0
GB
Crystal 10.

Hi,

I am need to create a {?Product} parameter that can be several individual product code values and/or a range of the same product code values. This is in 2 parts.

Part 1
When editing the parameter, I believe that I need to select the follow options:
1. 'Allow Multiple values'
2. 'Discrete and Range values'

The complete set of default values have been captured to be displayed for the user to select from.

The codes are AlphaNumerics (I have edit masked them as '>aaaa' (as they are all 4 characters in length).

Is this correct so far?

Part 2
Next, I then need to set this in the Record Selection Formula Editor. Here, I have to express this as crystal basic syntax so that the various selections are reflected in the report (The user may also select ALL if required).

How do I do this?

Thanks in advance,

Neal
 
Above should read 'Crystal' Syntax, NOT 'Crystal Basic' Syntax.
 
You don't need an edit mask if there is a dropdown list to choose from. Assuming you have added "All" to your list of values, you should be able to set this up in your selection formula like this:

(
if {?Product} <> "All" then
{table.product = {?Product} else
if {?Product} = "All" then
true
)

-LB
 
Thanks.

Unfortunately, I still have a problem with this.

(if {?Product} <> "All" then {SAMPLE.CL_BMS_PROD_CODE} = {?Product} else if {?Product} = "All" then true)

The {SAMPLE.CL_BMS_PROD_CODE} string is 50 chrs long - but only populates the first 4 chrs.

First
If I select 'ALL', OR, if I select a range from say 'AK10' to 'AW12', the report picks up every record (presumably because 'ALL' is alphabetically between these 2 values).

Second
If I select 'BA10' to 'SL29' then no records are displayed (there should be record output).

Also, if I drop the parameter into the report it is 'blank'.

 
One problem is that the code is not equal to any option, unless you limit it to the characters entered for the parm. If the instruction is to enter the first 4 characters, then you can create a SQL expression like {%code}:

left(table.`field`,4)

Or maybe:

{fn left(table.`field`,4)}

The syntax/punctuaion and use of the function depends upon your datasource/connectivity.

Then change the selection formula to:

(
if {?Product} <> "ZZZZ" then
{%code} = {?Product} else
if {?Product} = "ZZZZ" then
true
)

...where the default is now "ZZZZ" (you can use a description field of "All", while using a value like "ZZZZ" that is outside of any possible range).

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top