cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting grounds with 1 row of data

Former Member
0 Kudos

Hey everyone,

I am trying to only show groups that have exactly 1 row of data for a specialized sorting function I have drafted up.

Originally I planned to filter the groups by a running total but that didn't work out.

Anyone have any ideas?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hey all,

I actually solved this problem myself before it went live by using something close to Praveen's suggestions.

I used an if statement on the running total that counts the amount of details in my group.

Suppress (No Drill-Down):

if{#CountOfParts}<>1 then

true

else

false;

Abhilash

I initially attempted that method however I probably wrote :

Count({thegroup}, {thefield}) <> 1. Silly me.

Prathamesh

I would normally use SQL, however I've been spoiled by Crystal reports and all it's functionality. Moreover inputting SQL into Crystal 2008 is a pain, at least for me. Speed is not an issue for me at the moment but thanks for the input.

Thanks everyone!

-Antonio

I rescind my statement.

I was still having one or two problems and Abhilash's suggestion worked perfectly.

Thanks!

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Antonio,

If the report is required to show only the Groups having a single record and there is no other calculation involved, then this could also be handled at SQL level directly.THis could speed up the performance rapidly.A SQL can be written using the Add Command feature of Crystal Reports:

for e.g:

select * from emp group by dept_id having count(emp_id)=1

This will list such departments who have a single employee mapped to them.

-Prathamesh

abhilash_kumar
Active Contributor
0 Kudos

Hi Antonio,

Instead of using a conditional suppression formula for the section as Praveen suggests, I would recommend creating a Group Selection Formula.

Go to Report > Selection Formulas > Group and use this code:

count({database_field},{Group_field}) > 1

-Abhilash

former_member203168
Active Participant
0 Kudos

Hi Antonio,

Right click on the Group and select Section Expert > Suppress.

Click on (X-2) button.

Write below code in formula editor

Count({thefield}, {thegroup}) <> 1

--Praveen G