Getting only specific trnasactions for each group

Printed From: Crystal Reports Book — Forum Name: Technical Questions

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

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
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?
Likely.
Remove the record select and stick with the group select.
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
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
I will be needing to show only the Groups that has both types(CPK,MA)

Thanks.
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
worked like a charm. Thank you Sir.