crystal reports how to show grouping only when a column/field has more than one values

Hi,

I have a column in a dataset which can have two values val1 and val2. I want to group the records in crystal reports only if both values occur at least once in the records
Example
rd1 a1 b1 val1
rd2 a2 b2 val2

but it should not show grouping if all the records have val1.
LVL 7
Maverick_CoolAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

peter57rCommented:
I don't really understand what you are asking.

This is my reading of what you have posted - and imagining there are say 100 recrods..

If all 100 records show the value Val1 in the 4th field then you do not want the records to be grouped in any way?

But if there is at least one val1 and at least one Val2 then you want the records to be grouped - but grouped on which field?  The field that contains val1 and val2?

If this is so then I think the solution will involve grouping the records on the val1/val2 field but  suppressing the group header and footer if there is only one group.

Can there be values other than Val1 and Val2?
Can all values be Val2?

Can you confirm the requirements and data content before we go any further.





0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Maverick_CoolAuthor Commented:
Your assumption is correct.
Groupin on the field contailin val1 and val2
all values can be val1 or val2 or mixed

please tell how to do this with formulas
when i tried this its suppresing grouping if all val1, but if it contain val2, then the val1 header text is not shown.

scenarios
1. all val1
no groupin

2. atleast val1 and val2
val1 header text
records......
val2 header text
records......

3. all values val2
val2 header text
records....
0
mlmccCommented:
The only way I can think to do this is suggested by peter.

Add  a formula name - Val1Counter
If {Field4} = 'Val1' then
    1
else
    0

Group on the field

In the section expert conditionally suppress the group header with
Sum({@Val1Counter}) = Count({Field4})

mlmcc
0
mlmccCommented:
Just thought of another way to suppress it without the formula

DistinctCount({Field4}) = 1

mlmcc
0
James0628Commented:
Based on your last example, you only want to suppress the group header if val1 is the only value.  If val2 is the only value, you still want to see the header.  Or, to put it another way, you want to see the group header if any of the records have val2 in that field.

 In that case, create a formula like the following (call it whatever you want):

if {field} = "val2" then
  1


 Then use a formula like the following to suppress the group header:

Sum ({formula created above}) = 0


 That will suppress the group header if none of the records in the report have val2 in that field.

 James
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.