Getting only specific trnasactions for each group
Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22388
Printed Date: 29 Apr 2024 at 9:37pm
Topic: Getting only specific trnasactions for each group
Posted By: Nav522
Subject: Getting only specific trnasactions for each group
Date 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
|
Replies:
Posted By: DBlank
Date 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
|
Posted By: Nav522
Date 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?
|
Posted By: DBlank
Date Posted: 18 Jul 2017 at 12:23pm
Likely.
Remove the record select and stick with the group select.
|
Posted By: Nav522
Date 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
|
Posted By: DBlank
Date 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?
|
Posted By: Nav522
Date Posted: 19 Jul 2017 at 6:46am
I will be needing to show only the Groups that has both types(CPK,MA)
Thanks.
|
Posted By: DBlank
Date 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
|
Posted By: Nav522
Date Posted: 19 Jul 2017 at 6:55am
worked like a charm. Thank you Sir.
|
|