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

Parameters - those not picked default to "All"(or no rescrictions) 2

Status
Not open for further replies.

slimshades26

Technical User
May 10, 2002
61
US
CR 8.5
I have multiple parameters. I want to be able to make a choice on one or two and those that don't get picked default to "All"(or no rescrictions). Right now I do this and simply do not choose the others and I get no data at all. My test is that there should be some records with the selection I choose but I get 0 records like it is defaulted unchoosen parms and causing more rescrictions. I need "All" defaulted. I have 6 parms where as little as two may be chosen at a time. Thank you for any response. ss26
 
Do this for each one of your parameters.

In the parameter list, set a default value of 'ALL'.

In the Selection Criteria, enter the following:

(if {?Parameter1} = "ALL"
then True
else {Database.Field} = {?Parameter1}) and

...and so on 'til you run out of parameters...

Naith
 
That was it. My life is now complete...until my next road block. I appreciate the quick response. ss26
 
If performance is a concern:

I generally get better pass through by reversing Naiths' use of TRUE, and disqualifying the 'All' check with another if, as in:

(
if {?Parameter1} <> &quot;ALL&quot; then
{Database.Field} = {?Parameter1}
else
if
{?Parameter1} = &quot;ALL&quot;
true
)
and
...

Pass through is a dicey proposition, but make sure that you include the parens around the formula, and use a disqualifying else if, it generally helps.

Also, if you're using a multiple parameter:

(
if {?Parameter1}[1] <> &quot;ALL&quot; then
{Database.Field} in {?Parameter1}
else
if
{?Parameter1}[1] = &quot;ALL&quot;
true
)

and
...

-k kai@informeddatadecisions.com
 
PARM1if {?VendorName} = &quot;ALL&quot; then True else {F0101.ABALPH} = {?VendorName} and
PARM2if {?Vendor#} = 0 then True else {F4104.IVAN8} = {?Vendor#} and
PARM3if {?FSItem#} = &quot;ALL&quot; then True else {F4104.IVLITM} = {?FSItem#}
PARM4
If {?SortField} = (&quot;V&quot;) then totext({F4104.IVAN8}) else
if {?SortField} = (&quot;I&quot;) then {F4104.IVCITM} else
if {?SortField} = (&quot;F&quot;) then {F4104.IVLITM} else
if {?SortField} = (&quot;D&quot;) then {F4104.IVDSC1} else {F0101.ABALPH}
Otherwise this report is easy. It's all about giving the user the ability to manipulate the way they see the data. There are only 5 fields of data in the report. I used Naith's selection criteria formula here although I did try synapsevampire's also. The parms seem to be negating eachother. If I take the parms all out and begin to add them one at a time I can get the first one to work then I get after the second one is added if there is a certain number choosen it will read the parm that shows &quot;ALL&quot; as the choice. The sort by is the least of my concerns but actually seems to be working when I have been able to print records. I'm writing the formulas in the select expert. When I added the (parens) I got no data at all. So to review my rambling - I have Parm1 and Parm4 working. I can't add the others, even on default &quot;ALL&quot; without getting the entire database or worse nothing. This is kicking my *. Thanks for your help. ss26
 
Hey Slim,

Does the end of your 3rd parameter and beginning of the sort parameter syntax really go:
==============
if {?FSItem#} = &quot;ALL&quot; then True else {F4104.IVLITM} = {?FSItem#}

If {?SortField} = (&quot;V&quot;) then totext({F4104.IVAN8}) else
==============
?

Taking the sort out of the picture for a second, if you run the report with just the 1st 3 parameters in the record selection, is everything hunkidory? Because for me, the parameters are behaving themselves.

Naith
 
Thx. Knowing that the parms looked correct kept me digging. I found a couple quirks and of course Crystal crashed on me a few times. So after rebooting etc I came up with 4 parms (1 being the sort). I had an issue with string vs number and the formula wigging out. But it looks like it is stable now. Thanks so much Naith. ss26 ss26
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top