Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Getting only specific trnasactions for each group 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: Getting only specific trnasactions for each group
    Posted: 18 Jul 2017 at 4:52am
Hello Good day.

I'm trying to figure out a way to bring in only specific groups that has specific transactions (MA,CPK)any other transactions then suppress the whole group. How to achieve this?

Sample Data:

       Source     TRX      POLICY

GH1        1       MA       123
GH1        2      MA       345
GH1        2      CPK      345
GH1        3       NA      456


I only want to see this as Output and suppress the rest
           Source     TRX      POLICY
GH1        2      MA       345
GH1        2      CPK      345

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Jul 2017 at 9:32am
Not entirely sure what you are trying to do but you can consider creating a formula field to 'flag' specific rows then use that result in a group summary and the group summary to do a group select criteria or group suppression
//@flag example
if table.field IN ['MA','CPK'] then 1 else 0

group select example
SUM(@flag,table.groupfield) = 0
IP IP Logged
Nav522
Senior Member
Senior Member


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 166
Quote Nav522 Replybullet Posted: 18 Jul 2017 at 10:16am
Hello there thanks for your response.

I created a flag formula and in the Selection Formula I did included the
SUM(@flag,table.groupfield) = 0

The report comes up as blank. I did notice I have a filter in the record selection as table.field = ['MA','CPK']. Is that causing an issue?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Jul 2017 at 12:23pm
Likely.
Remove the record select and stick with the group select.
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 Jul 2017 at 5:38am
It still doesn't work, think im still missing the logic,

I think I need to go over just to correct myself and give the right specifics.

So here's data in Detail Section. How do I achieve just the output?


       SOURCE     TRX     POLICY    FLAGFORMULA
    GroupHeaderName : 01
D       01       MA       123           1
    GroupHeaderName: 02
D        02      CPK      345           1
D        02       MA      345           1
   GroupHeaderName : 03
D        03       NA      456           0
   GroupHeaderName : 04
D        04       MA      789          1

I only want to see this as Output and suppress the rest
--------------------------------------------
           SOURCE     TRX      POLICY
D          02        CPK           345
D          02        MA          345
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Jul 2017 at 6:09am
Do you mean you only want a group where ALL records in that group are either CPK or MA? or a a Group has both types?
Or a combination of those two criteria?

Edited by DBlank - 19 Jul 2017 at 6:10am
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 Jul 2017 at 6:46am
I will be needing to show only the Groups that has both types(CPK,MA)

Thanks.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Jul 2017 at 6:51am
Ahh,You will need two flags


//@MAflag example
if table.field IN ['MA'] then 1 else 0

//@CPKflag example
if table.field IN ['CPK'] then 1 else 0

group select example
SUM(@CPKflag,table.groupfield) > 0 AND SUM(@MAflag,table.groupfield) > 0
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 Jul 2017 at 6:55am
worked like a charm. Thank you Sir.
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.