Link to home
Start Free TrialLog in
Avatar of Nicole McDaniels
Nicole McDaniels

asked on

Null as value for Dynamic parameter in CR2008?

Hi
I have a report with a parameter "Problem Code" that is currently set to Dynamic. The users want to be able to add a "Blank" value as a selection so they can still include records with "Problem Code" even if it's null. Is that even possible? In my select expert I just have

{BAX_V_REPORTED_PROBLEM_CODE} = {?Problem Code}
Avatar of Serena Hsi
Serena Hsi
Flag of United States of America image

For your null or blank values, try:

IsNull({BAX_V_REPORTED_PROBLEM_CODE}) or {BAX_V_REPORTED_PROBLEM_CODE} <> “?Problem Code”
Avatar of James0628
James0628

If you want the report to always include the null values, then something like Serena's suggestion might work, although I think

 <> “?Problem Code”

  should be

= {?Problem Code}


 However, as I understand it, the users want to be able to specifically ask for the null values, and have them only be included when they ask for them.  If that's the case, how are you building the list of values for the parameter?  If you're using a Command (ie. a manual query), you could modify the query so that it includes the space as another value for the parameter (this is assuming that the Problem Code field is never actually blank).  For example, if the current query was

SELECT BAX_V_REPORTED_PROBLEM_CODE FROM some_table

  you could add

UNION

SELECT " "

 That would add the space as another value in the list.

 Then your record selection would be something like:

(
( {?Problem Code} = " " and IsNull ({BAX_V_REPORTED_PROBLEM_CODE}) ) or
{BAX_V_REPORTED_PROBLEM_CODE} = {?Problem Code}
)

 James
Depending on your database you may have to use a left outer join or even use a command.

mlmcc
Avatar of Nicole McDaniels

ASKER

James, I am not currently using a command, currently my parameter is defined as "Dynamic" in the parameter fields only (and then in the Select Expert as table=?Problem code.)
So, to use a command, how would I use what you have to create a selection of "BLANK" for the user to choose if they wish but also populate the picklist as well?
So, when the report is run, the user would be able to choose from:
BLANK
Problem Code 1
Problem Code 2
Problem Code 3
etc

They want to be able to choose multiple values (e.g. BLANK, PROBLEM CODE 1, PROBLEM CODE 2)
I have this but I know it's not right...I am very brand new to commands!

select " "  as BLANK from dual
union all
SELECT  AS_REPORTED_PROBLEM_CODE FROM BAX_V_GCMS_COMPLAINT_RECORD
How about using a second parameter?

The second could just ask if they want to include NULL values.  Then you modify the select statement based on the response.

In the report did you just select tables from the database?
If so is the selection being done on the main table or one of the joined tables?

From your sample command I assume you are using Oracle.

mlmcc
Yes, I just selected tables from the DB and it is being done on joined tables. So If I add another parameter like Include Null values YES/NO how would I modify the select stmt to include null AND whatever values are in the original Problem Code param?

if {?Null Problem Code}="YES" then isnull({BAX_V_GCMS_COMPLAINT_RECORD.AS_REPORTED_PROBLEM_CODE}) and
{BAX_V_GCMS_COMPLAINT_RECORD.AS_REPORTED_PROBLEM_CODE} = {?Problem Code} ??

Doesn't that contradict?
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It worked, thanks!