on 05-30-2013 10:21 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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,
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.