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!

Record selections based on two different fields

Status
Not open for further replies.

teachmecr

Programmer
Oct 1, 2006
72
US
i have a report that has 2 fields (besided othe fields) called account_parent and account_sub. When account_parent is selected i wana be able to display records with all the sub accounts but when only sub account is selected i wana display records only with that selected sub account. I did delcare two separate parameters but for some reason its not working out for me. im using cr 10.0. any kind of of help would be appreciated. Thanks.
 
Please post your record selection formula in its entirety.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"A fine is a tax for doing wrong. A tax is a fine for doing well.
" - unknown
 
Typically this is done by setting a default value of "All" for each parameter. Use the Set Default Value button to add in a default value within the parameter editor.

So then the record selection states:

(
if {?account_parent parameter} <> "All" then
{table.account_parent} = {?account_parent parameter}
else
if {?account_parent parameter} = "All" then
true
)
and
(
if {?account_sub parameter} <> "All" then
{table.account_sub} = {?account_sub parameter}
else
if {?account_sub parameter} = "All" then
true
)

Now if they set the account_parent parameter to All, then it will observe the account_sub parameter only, or if they set something in the account_parent parameter and set the account_sub parameter to All, it will show only the account_parent values, plus it gives them the opportunity to select specific parents and children.

Unfortunately Crystal 10 does not have dynamic parameters, but you can also preload the values as static from the database and they can select them rather then enter them, just make All the first choice in each, which then makes it the default.

-k
 
Try Changing the operator to an "OR" See Below:

(
if {?account_parent parameter} <> "All" then
{table.account_parent} = {?account_parent parameter}
else
if {?account_parent parameter} = "All" then
true
)
or
(
if {?account_sub parameter} <> "All" then
{table.account_sub} = {?account_sub parameter}
else
if {?account_sub parameter} = "All" then
true
)
 
where do i put in this formula? do i put it in select expert if yes for which field would i have to insert it in. thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top