Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Tips and Tricks
Message Icon Topic: Some Help please Post Reply Post New Topic
Author Message
Paul Hamilton
Newbie
Newbie


Joined: 18 Apr 2012
Location: United Kingdom
Online Status: Offline
Posts: 5
Quote Paul Hamilton Replybullet Topic: Some Help please
    Posted: 19 Apr 2012 at 4:55am
Hi
 
New to the group and hope you can help with a query?
 
I've been asked to create a report that uses multiple parameters, but not all of them will be selected when running the report, so need to know how I code the select statement to allow for blank entries if not required?
 
Thanks
Paul Hamilton
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Apr 2012 at 4:59am
what version are you using?
IP IP Logged
Paul Hamilton
Newbie
Newbie


Joined: 18 Apr 2012
Location: United Kingdom
Online Status: Offline
Posts: 5
Quote Paul Hamilton Replybullet Posted: 19 Apr 2012 at 5:01am
2008
 
Thanks
Paul Hamilton
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 19 Apr 2012 at 5:07am
Not certain exactly what you want as there isn't really enough information, however I'll assume you have a SQL command you wish to pass parameters too to filter records.
 
For examples sake we'll say you've got an optional country parameter, if left blank you want to return all countries otherwise return the country selected.
 
First create the {?country} parameter, set the default value as a single space (or whatever else you'd like to use).
 
To incorporate this in to your query it would look something like this;
 
select *
 
from countries
 
where
countries.name = case when {?country} = " " then countries.name else {?country} end
 
Very simple example but hopefully you get the idea.
 
Regards,
Ryan.


Edited by rkrowland - 19 Apr 2012 at 5:09am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Apr 2012 at 5:10am
2008 allows for no param to be entered.
you can use the
hasvalue(?param)
not(hasvalue(?param))
to define how the select expert should act.
here is an example
 
IP IP Logged
Paul Hamilton
Newbie
Newbie


Joined: 18 Apr 2012
Location: United Kingdom
Online Status: Offline
Posts: 5
Quote Paul Hamilton Replybullet Posted: 19 Apr 2012 at 5:12am
Thanks guys
Paul Hamilton
IP IP Logged
Paul Hamilton
Newbie
Newbie


Joined: 18 Apr 2012
Location: United Kingdom
Online Status: Offline
Posts: 5
Quote Paul Hamilton Replybullet Posted: 19 Apr 2012 at 10:54pm
Good morning
Have had a look at the help some of you gave yesterday, but still a bit stuck.  Here is a bit more detail on my query.
From the Report Fields listed below, the report requestor would like to have the function of selecting 1 field and not having to select anything else, or multiple fields and again leave those not required blank.
Here's what I've got so far:
 
{?Template} ="" and
{?PTL Number} = "" and
{?Requestor Name} = "" and
{?CI Name} ="" and
{?Impact} ="" and
{?Status} ="" and
{?Source} ="" and
{?Completion Code} ="" and
{?Opened By (Group)} = "" and
{?Closed By (Group)} = "" and
{?Service Name} = "" and
{?Closed By (PTL)} ="" and
{?Opened By (PTL)} ="" and
{Incident.Full Name Assigned To} ={@FullName 2} and
{Incident.Open Date & Time}>={?FromDate} and
{Incident.Open Date & Time}<={?ToDate} and
{Incident.Status Description:} in ["Accepted", "Assigned", "Change Pending", "Closed", "ClosedMail", "Completed", "In Progress", "Waiting For Customer", "Waiting for..."] and
{Incident.Group Name} = {?Group}
 
Any help would be much appreciated.
 
Thanks
 
Paul
Paul Hamilton
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Apr 2012 at 7:25am
I have not used 2008 yet so I am not exactly sure on the syntax.
 
maybe...
((not(hasvalue({?Template}))) or {?Template}={table.templatefield})
and
((not(hasvalue({?PTL Number}))) or {?PTL Number}={table.PTLfield})
and
((not(hasvalue({?Requestor Name}))) or {?Requestor Name}={table.requestorfield})
and
...
 
 
 
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.