Search code examples
crystal-reports

Crystal Reports: one parameter set works while another doesn't


I have two parameters - one for position and one for day/night/all. The position is set up so that if a user selects, for example, captain, then the report pulls all records pertaining to the keyword captain and captain-like. It works fine until the parameter is paired with the other parameter. I don't know why?

I have followings in the Selection Expert.

if {?Day_Night} ='Day' then {?Day_Night}={Command.Day}
else if {?Day_Night}='Night' then {?Day_Night}={Command.Night}
else if {?Day_Night}='All' then {?Day_Night}= {Command.day_night}
and
If {?Position} = "ALL" then {Command.category} like "*"
else if {?Position} = "Captain" then {Command.category} like "Captain*"
else if {?Position} = "Driver" then {Command.category} like "Driver*"
else if {?Position} = "EOC staff" then {Command.category} like "EOC staff*"
else if {?Position} = "Firefighter" then {Command.category} like 
"Firefighter*"
else if {?Position} = "Lieutenant" then {Command.category} like 
"Lieutenant*"
else if {?Position} = "Master" then {Command.category} like "Master*"
else if {?Position} = "PSCS" then {Command.category} like "PSCS*"

Why won't they link up? Please help!


Solution

  • "And" expression should be between two logical expressions like

    if ({?Day_Night} ='Day') and ({?Position} = "ALL") then ({?Day_Night}={Command.Day}; {Command.category} like "*") else...
    

    Not sure about ; how exactly Crystal will treat you for that, but I believe you got the idea. The way you designed it,you would probably need 30 combinations of Day_Night and Position conditions now. But maybe you can find a different way to accomplish your report.