Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Parameter IF and TRUE Post Reply Post New Topic
Author Message
justin
Newbie
Newbie
Avatar

Joined: 26 Mar 2009
Location: Australia
Online Status: Offline
Posts: 6
Quote justin Replybullet Topic: Parameter IF and TRUE
     Posted: 02 Jun 2015 at 2:10pm
Hi,

Crystal Reports 12.7.1.2131

I have parameter values set up for users to select specific values or All records.  The following works fine:

if {?Status} <> "(All)" then
    {audmmast.det_cde} = {?Status}
else
    true

But the following does not, it returns multiples of all records:

if {?Status} = "(All)" then
    true
else
    {audmmast.det_cde} = {?Status}

The reason for the second formula is that I want to introduce a parameter called "(None)" to select only records that have a NULL value in the audmmast.det_cde field.  I can not get this to work however until I figure why the second formula doesn't work.

Anyone have any ideas?

cheers

Justin

EDIT: I should add that there are other record select options, here is the full working select formula:

if {?Status} <> "(All)" then
    {audmmast.det_cde} = {?Status}
else
    true
and
{audmrefs_rating.ref_typ} = "dda_cd5" and
{audmrefs_rating.fil_typ} = "150" and
{audmrefs_derived.fil_typ} = "150" and
{audmrefs_derived.ref_typ} = "dda_cd3" and
{audmrefs_dept.fil_typ} = "150" and
{audmrefs_dept.ref_typ} = "dda_cd1" and
{audmmast.doc_typ} = 150


Edited by justin - 02 Jun 2015 at 2:19pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Jun 2015 at 4:19am
First set the select formula option to 'use default values for nulls'.
if you don't it will stop evaluating when it hits a null, or you will have to alter the code to handle any possible null fields first.
 
your select should look something like this:
 
(
{?Status} = "(All)"
or
({?Status} = "(None)" and {audmmast.det_cde} IS NULL)
or
{audmmast.det_cde} = {?Status}
)
and
{audmrefs_rating.ref_typ} = "dda_cd5" and
{audmrefs_rating.fil_typ} = "150" and
{audmrefs_derived.fil_typ} = "150" and
{audmrefs_derived.ref_typ} = "dda_cd3" and
{audmrefs_dept.fil_typ} = "150" and
{audmrefs_dept.ref_typ} = "dda_cd1" and
{audmmast.doc_typ} = 150
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum