Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Help:Parameters not returning data Post Reply Post New Topic
Author Message
Nav522
Senior Member
Senior Member


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 166
Quote Nav522 Replybullet Topic: Help:Parameters not returning data
     Posted: 18 Jan 2010 at 3:51pm
Hello Folks,
                   I have created a crystal report using Command option. It returns data for all the clients for the previous month. NOw my requirement is to modify the report to take parameters such as clientcode and Monthyear and return the data based on the parameters. Here the requirement is if we choose the parameters as
clientcode = ALL
and Monthyear=NULL then it shoud return all the clients data for previous month and if we choose parameters with specific client and specific month such as
clientcode = CRV
Monthyear=DECEMBER2009 it should return only for that particular client CRV. I have tried using the below code in the selection criteria but i coudnt get the results i want. Can anybody throw some light on this. Thanks
 
code that i hav used:
{Command.PERIOD}={?MonthYear} or {?MonthYear}='NULL'
and

(
 ( {Command.CLIENT}={?Clientcode} or
   {?Clientcode} = 'ALL'
 ))
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 19 Jan 2010 at 6:10am
Null is not a value, per se, it is the lack of one, and so you test for equality with the =.  Also, you need to group your logical expressions or the 'OR' will give unexpected (and not what you're looking for) results.
 
Try
({Command.PERIOD}={?MonthYear} or ISNULL({?MonthYear}))
and
({Command.CLIENT}={?Clientcode} or {?Clientcode} = 'ALL')
 
IP IP Logged
Nav522
Senior Member
Senior Member


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 166
Quote Nav522 Replybullet Posted: 19 Jan 2010 at 7:03am
Hey thanks for getting bak. The logic works when i select a specific client and a specific month. But when i try to choose the parameters Cientcode= ALL and MonthYear=NULL it shows blank. I have a group on client name and i am not sure what else is missing.Any ideas
 
Thanks
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 19 Jan 2010 at 9:20am
Also always to Null checks first, I know it should not matter but it does.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 20 Jan 2010 at 7:27am
No, you're right kevlray...
DBlank always reminded us to do exactly that.
 
This is my thoughts on what is happening in CR that we can't see.  CR tries to compare the values, and one is NULL, this throws an error (at least it would in .Net), instead of raising the error to our attention, CR suppresses it and continues on its way.  Not very helpful to the report writer, but cuts down on issues of bad data, which I am sure are plentiful. When you check ISNULL first, CR says, look this part is true, let's not check the rest of the statement and continues on its way.
 
Just something to keep in mind, but you're right, check the ISNULL first.
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