Print Page | Close Window

how to group 2 different fields

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=6418
Printed Date: 28 May 2024 at 3:48am


Topic: how to group 2 different fields
Posted By: einas
Subject: how to group 2 different fields
Date Posted: 20 May 2009 at 9:05pm
Hi,

I would like to know if there is a way to group 2 different fields into 1?

Please help advise.

Thank you.


-------------
eInaS



Replies:
Posted By: lockwelle
Date Posted: 21 May 2009 at 6:22am
write a formula that uses the 2 fields in the way that you want and then group on the formula.
 
 


Posted By: einas
Date Posted: 21 May 2009 at 8:51pm
Hi Lockwelle,

Thanks for the reply. But I have no idea on the formula actually.
Appreciate if you can share me the formula..


Thank you very much.


-------------
eInaS


Posted By: lockwelle
Date Posted: 22 May 2009 at 6:28am
if there is no logic that would ever change for the grouping then:
right click on formulas, select new.  Give it name...Grouping1
 
in the formula:
{table.field1} + {table.field2}
 
if they aren't the same data type you will need to add conversions to one or both of the fields so that they match.
 
now create a group, and instead of choosing a field from the list, find the formula Grouping1.  There will be a 'X+1' icon in front of it.
 
all done.


Posted By: einas
Date Posted: 25 May 2009 at 9:05pm
Hi lockwelle ,

That is not what I mean , let me explain in more details:

If let say I have a list of data as below.


1) Daniel  - Meeting
2) Alice  -   Call
3) Mona -  Task
4) Daniel - Call
5) Alice -    Meeting
6) Mona -   Call

So, I need a formula to group them up and display the data as below:

Meeting
Alice
Daniel

Call
Alice
Daniel
Mona

Task
Mona

For your information,  Call, Task and Meeting are from different tables.

Thank you in advance





-------------
eInaS


Posted By: lockwelle
Date Posted: 27 May 2009 at 6:35am
This is intriguing.
 
Off hand I can't think of a formula that would work, since the common factor is the name.  If they all come from different tables, this is when I would say use subreports.  No grouping is going to work, not coming straight from the tables.
 
If you used a stored proc, you could set a column to where they came from and then you could group on that, but binding straight to the tables, I don't see a solution.
 
Perhaps someone else has an idea?


Posted By: einas
Date Posted: 31 May 2009 at 7:03pm
Hi lockwelle ,

Thanks for the idea.
Anybody else who has the idea..help me please..


Thank you very much.


-------------
eInaS


Posted By: DBlank
Date Posted: 01 Jun 2009 at 7:10am
You indicate "Call", "Task" and "Meeting" are from different tables but are you joining them together onto another table into the report or are you just dropping the 3 tables in without a join?
If joined and you were to display the sample data from above in a row with all 3 fields from each of the tables do you have something like what is below or something else?
Name    Call_Field           Task_Field           Meeting_Field
Daniel      NULL                    NULL                      Meeting
Alice         Call                    NULL                        NULL                     
Mona       NULL                    Task                      NULL                     
Alice         NULL                   NULL                       Meeting                  
Mona        Call                    NULL                       NULL    



Posted By: einas
Date Posted: 09 Jun 2009 at 8:21pm
Hi DBlank,

I have tried to join those 3 tables but cannot. What i am supposed to do then?

Thank you very much for your attention.


-------------
eInaS


Posted By: DBlank
Date Posted: 10 Jun 2009 at 6:55am

Sorry, I am at a loss.



Posted By: lockwelle
Date Posted: 10 Jun 2009 at 11:00am
it is looking like you will need to create a store proc or a view or create 3 subreports, one for each type of event, since all that is being displayed (so far) is the name.



Print Page | Close Window