when users do not enter a selection in a parameter field, the report does not return any data - is there a way of making it select everything if no criteria is entered?
I often prepopulate the Parameter with 'All' or something akin (as was suggested above with *) to demonstrate to users that everything is an option.
In that case you can test for either All or nothing entered with:
(
If trim({?Parameter}) <> '' and
trim({?Parameter}) <> 'All' then
{table.field} = {?Parameter}
else if
{?Parameter} = '' or
{?Parameter} = 'All' then
true
)
This now handles either selecting All or blank.
Note: I intentionally construct the record selection criteria in all the above overkill glory to improve SQL pass through to the database (improve performance).
That formula accepts multiple values. What it doesn't contend for is partial strings. Like "Na%" for "Naith" and "Nadia". You'd use the 'like' function for that like Rhinok showed.
All you'd use the join function for is for displaying the multiple values of the parameter, not for affecting the results returned.
When I use the formula (in the record selection formula editor) with a parameter that "allow multiple values", I get an error stating...
"This array must be subscripted. For example: Array ."
However, when I deselect the "allow multiple values" option for the parameter, I don't receive an error and the formula works correctly. Any thoughts on what I'm experiencing?
Multiple values aren't handled that easily at all - unless you use the 'like' operator.
Like you've suspected, you'd have to quantify multiple value parameters in the selection criteria by subscripting the parameter - which basically means that you would refer to the parameter like {?Parameter}[2] or [3] or whatever.
Trouble is, when you do that, you are really trying to predict how many values will be entered to the parameter at runtime, as whatever number you enter in [n] is essentially saying 'expect this many values'.
If you need your parameter to work with multiples values - the amount of which to remain dynamic - then I would settle for using 'like'.
Sorry for the misinformation earlier. I guess I must not have been thinking straight, poor excuse as it is.
Didn't mean to be so harsh on my myself by striking my comments out.
Naith,
To clarify, I was having issues with synapsevampire's formula when using a parameter that accepts multiple values. I just tested yours, and it works for both scenarios. And it will meet my needs b/c I will be placing my wildcard ("ALL" at the top of the parameter selection list, so the default will be running for "ALL".
I mean, if you set your parameter to say {?Get Letters} = 'A', the SQL passed to the database will omit this clause, forcing the database to get all letters.
Crystal then sorts through the dross and displays the information your parameter desired.
When something is passed to the database, Oracle will know to only get letters which equal "A", which is more efficient and can be quicker. But if your dataset isn't really that big, you probably won't notice that much performance difference, if any at all.
This is all circumstantial anyway, because if you have a multiple value parameter, you aren't going to be getting that passed to the database in the first place.
So if the SQL doesn't pass to the database, more of the processing/filtering is done outside of the database...so more stress on the database, more traffic on the network, and more processing done by the Crystal workstation/Info Server. Something like that?
What I don't understand is: How do you know what does and what does not pass to the database? Can you point me in the direction of any documentation I can reference that discusses this? Seagate/Crystal Decisions technical briefs? I'm envious of this knowledge...
(
If trim({?Parameter}[1]) <> '' and
trim({?Parameter}[1]) <> 'All' then
{table.field} in {?Parameter}
else if
{?Parameter}[1] = '' or
{?Parameter}[1] = 'All' then
true
)
This assumes that All or blank will be the first choice, so make sure it's at the top of the list.
This is designed to increase the likelihood of pass through SQL.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.