Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: how to group 2 different fields Post Reply Post New Topic
Page  of 2 Next >>
Author Message
einas
Newbie
Newbie
Avatar

Joined: 10 Mar 2009
Location: Malaysia
Online Status: Offline
Posts: 7
Quote einas Replybullet Topic: how to group 2 different fields
    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
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet 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.
 
 
IP IP Logged
einas
Newbie
Newbie
Avatar

Joined: 10 Mar 2009
Location: Malaysia
Online Status: Offline
Posts: 7
Quote einas Replybullet 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
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet 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.
IP IP Logged
einas
Newbie
Newbie
Avatar

Joined: 10 Mar 2009
Location: Malaysia
Online Status: Offline
Posts: 7
Quote einas Replybullet 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
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet 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?
IP IP Logged
einas
Newbie
Newbie
Avatar

Joined: 10 Mar 2009
Location: Malaysia
Online Status: Offline
Posts: 7
Quote einas Replybullet 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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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    



Edited by DBlank - 01 Jun 2009 at 7:11am
IP IP Logged
einas
Newbie
Newbie
Avatar

Joined: 10 Mar 2009
Location: Malaysia
Online Status: Offline
Posts: 7
Quote einas Replybullet 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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Jun 2009 at 6:55am

Sorry, I am at a loss.

IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.