Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Eliminate rows. Post Reply Post New Topic
Author Message
me_salman148
Newbie
Newbie
Avatar

Joined: 16 Oct 2012
Location: India
Online Status: Offline
Posts: 6
Quote me_salman148 Replybullet Topic: Eliminate rows.
     Posted: 20 Jan 2014 at 12:27am
Hi All,


I have a small requirement,
for example.

Table 1

Emp#    Name    Role
101     ABC     MGR
102     DEF     DEV
103     GHI     TEST
104     XYZ     DEV

Table 2


Emp#    Phone
102     99853
103     59982

Due to some join conditions, i'm using sub report for retrieving 'Phone' data and using Emp# for subreport linking.

My requirement

Emp#     Name    Role    Phone
102      DEF     DEV     99853
103      GHI     TEST    59982


But i'm getting

Emp#    Name    Role     Phone
101     ABC     MGR
102     DEF     DEV      99853
103     GHI     TEST     59982
104     XYZ     DEV


i want to eliminate the rows which are getting as NULL for Phone in main report.
How can i?
IP IP Logged
lolly54
Groupie
Groupie
Avatar

Joined: 25 Sep 2011
Online Status: Offline
Posts: 58
Quote lolly54 Replybullet Posted: 20 Jan 2014 at 9:43pm
What join conditions are you using?
Can't you join the {Table 1.emp#} and {Table 2.emp#} together with inner join?

Inner join should return matching records only.
IP IP Logged
me_salman148
Newbie
Newbie
Avatar

Joined: 16 Oct 2012
Location: India
Online Status: Offline
Posts: 6
Quote me_salman148 Replybullet Posted: 21 Jan 2014 at 7:27pm
Above data is just an example,

Due to some filter conditions in base query, i'm getting Phone as null for all Emp#, thus i used it as sub report.
IP IP Logged
me_salman148
Newbie
Newbie
Avatar

Joined: 16 Oct 2012
Location: India
Online Status: Offline
Posts: 6
Quote me_salman148 Replybullet Posted: 29 Jan 2014 at 12:00am
Done.

I created shared variable array which consist of Emp# from sub-report and applied a suppress condition, if Main report Emp#=sub-report Emp# then false else true.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 29 Jan 2014 at 5:14am
run your subreport above the detail line that displays the results...there are some tricks to this, but then you can suppress.

also, since the subreport is already linked to the Emp# in the main report, I would check on if the Phone# is null...the suppression formula is simply:
isnull(Phone#)

if the phone# is null, then the statement is true and CR will suppress, if there is a value, the statement is false and CR will display...it saves some typing.

HTH
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