cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Default values - Crystal Report

Former Member
0 Kudos

Hi,

is there a way to set multiple values as the default value in a crystal reports paramter?

If I enter multiple values separated by a semicolon displays it as one value.


Cheers

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Leo,

You can only set one value as default. If you type in a comma separated string in the 'Default Values', then it is treated as a single value.

What you can, however do is create a record selection formula that runs different checks before showing the data. Like this

Note: This is assuming the prompt itself is set to allow multiple values.

stringvar array arr;

if ubound({?Prompt}) = 1 then

(

    if instr({?Prompt}[1],",") > 0 then

    (

        arr := split({?Prompt}[1],",");

        {database_field} IN arr;

    )

    else

        {database_field} = {?Prompt}

)

else

    {database_field} IN {?Prompt}

Hope this helps!

-Abhilash

Former Member
0 Kudos

Hi,

Sorry, just to clarify the formula you stated is how you can use a multiple selection paramter in a selection formula? is that correct?

Also, there is definitely no way to set a crystal reports paramter to use multiple default values?

Thanks,

abhilash_kumar
Active Contributor
0 Kudos

Hi Leo,

You can set multiple default values for a parameter by typing in a comma separated string of values in the 'Default Values' option.

You can also set this prompt to allow selection of multiple values from the drop-down. This is done by setting the option 'Allow Multiple Values' to True.

When you have this kind of a setup, you need to make sure the record selection formula is ready to accept both types of values - the default comma separated string or the values that you choose from the drop-down. The selection formula I posted above, takes care of the situation.

-Abhilash

Former Member
0 Kudos

Hi,

Very interesting and good solution!

However, I am working with a variable from BEx. I dont want to set the variable to default to certain values in BEx as the default values are per report. So I am looking to set the default values in Crystal.

I may look into creating a user exit variable in BEx which can decipher the prompt values sent with commas like your formula and see if that works.

Cheers,

abhilash_kumar
Active Contributor
0 Kudos

Oh, the solution won't work for a BEx query for sure. I think what you've decided to do is the way to go then.

-Abhilash

Answers (0)