Technical Questions
 Crystal Reports Forum : Crystal Reports 9, X, XI, 2008, 2011 : Technical Questions
Message Icon Topic: Multiple Selection Criteria Post Reply Post New Topic
Author Message
HSD89
Newbie
Newbie
Avatar

Joined: 27 Jul 2012
Location: United Kingdom
Online Status: Offline
Posts: 11
Quote HSD89 Replybullet Topic: Multiple Selection Criteria
    Posted: 27 Jul 2012 at 5:49am
Hi guys require some help, a little new to this forum so i hope ive posted in the correct part!
 
Im creating a report that will enable me to pick up flags raised on certain file numbers.
 
each file will have at least one flag, but some could have multiple flags. I want my report to say "if {cat.flag} has both "NST" and "PBS" then display "1 hour" and only count it once.
 
the problem im having at the moment is the report is showing an entry for the same file number twice (one for "NST" and one for "PBS")
 
can someone help me please? Im all out of ideas :(
IP IP Logged
DBlank
Senior Member
Senior Member


Joined: 19 Dec 2008
Online Status: Offline
Posts: 7797
Quote DBlank Replybullet Posted: 27 Jul 2012 at 9:45am
group on the file nuber
create formula fields to convert your rows into 1 or 0 and then sum these at the group level to determin your text
//NST flag
if type=NST then 1 else 0
//PBS flag
if type=PBS then 1 else 0
 
for you 1 hour display
if sum(NST flag,filenumber)>0 and sum(PBSflag,filenumber)>0 then '1 hour'
place in group header or footer
suppress details.
as for counting create a Running Total and use an evaluate formula
 
name=PBSNSTCount
type=distinctcount
field=filenumber
evaluate = use f formula
sum(NST flag,filenumber)>0 and sum(PBSflag,filenumber)>0
reset=never
place in report footer
IP IP Logged
amanda5615
Newbie
Newbie


Joined: 20 Apr 2012
Location: United States
Online Status: Offline
Posts: 17
Quote amanda5615 Replybullet Posted: 27 Jul 2012 at 9:49am
create a formula
Named Flag, inside that forumla
(if {cat.flag} = "NST" then 1 else 0) +(if {cat.flag} = "PBS" then 1 else 0)
Then create another forumla called HOURFLAG
If {FLAG} = 2 then "1 Hour"
I am sure there is an easier way to do this, but this is the quickest way I coudl think of.
IP IP Logged
HSD89
Newbie
Newbie
Avatar

Joined: 27 Jul 2012
Location: United Kingdom
Online Status: Offline
Posts: 11
Quote HSD89 Replybullet Posted: 31 Jul 2012 at 3:32am
thanks for the input guys but still a little confused (please be patient, i am still finding my feet can you believe!)
 
i created a formula that looks like this :-
 
if {Category.Flag}= "NST" then "00:45" else
if {Category.Flag}= "SET" then "2:00" else
if {Category.Flag}= "NST" AND "PBS" then "1:00"
 
obviously the above will not work, but is there no way the change this forumla slightly to get it working?
 
many thanks in advance folks
IP IP Logged
DBlank
Senior Member
Senior Member


Joined: 19 Dec 2008
Online Status: Offline
Posts: 7797
Quote DBlank Replybullet Posted: 31 Jul 2012 at 3:55am
i assume you have 1 category per row in your data set and you can have any total number of rows per file (group).
you need to create 2 different formulas to see if each group has at least 1 row per group of NST and SET types.
 
//NST_flag
if {Category.Flag}= "NST" then 1 else 0
//SET_flag
if {Category.Flag}= "SET" then 1 else 0
 
create summaries for each of these a the group level
//NST Sum
sum(@NST_Flag,table.filenumber)
//SET sum
sum(@SET_Flag,table.filenumber)
now if each of these sums is > 0 then you have found a file (or group) that meets your conditions.
 
IP IP Logged
HSD89
Newbie
Newbie
Avatar

Joined: 27 Jul 2012
Location: United Kingdom
Online Status: Offline
Posts: 11
Quote HSD89 Replybullet Posted: 31 Jul 2012 at 5:54am
DBlank thank you for your response. This has helped me to understand what i need to do!
 
How would i identify which of the cases have both an "NST" and "PBS" flag together?
IP IP Logged
DBlank
Senior Member
Senior Member


Joined: 19 Dec 2008
Online Status: Offline
Posts: 7797
Quote DBlank Replybullet Posted: 31 Jul 2012 at 6:18am

if you want to limit the report to only selecting those you would use group select criteria

if you want to a count you can use a running total - rt (or shared variable formulas
the rt version is
right click on Running Totals and select New
name=PBSNSTCount (or whatever you want)
type=distinctcount
field=table.lfilenumber
evaluate = use a formula
    sum(NST flag,filenumber)>0 and sum(PBSflag,filenumber)>0
reset=never
place in report footer
 
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.469 seconds.