Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Group and count multiple fields Post Reply Post New Topic
Author Message
deanrhurst
Newbie
Newbie
Avatar

Joined: 14 Apr 2010
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote deanrhurst Replybullet Topic: Group and count multiple fields
    Posted: 30 Sep 2013 at 4:32am
Hi

I am using crystal X1.

I have to create a report to total up the number of book sales we are making on a certain project.

My issue is;

-we have 50 different books we sell

-For each order the customer could order up to 3 different books

-In the data the book they have ordered will write to one of 3 fields

so my data headers looks like:

customerinfo | order1 | order2 | order3 |

So my actual data would look like:

Mr Jones | Book1 | Book2|Null|
Mr Smith | Book 7 | Book 4|Null|
Mr Toms | Book3 | Book 8 | Book 2|

etc etc etc

I need to create a report that tells me how many of each book have been sold.

So my report would look like:

Book 1 = 5 sales

Book 2 = 3 sales

Book 3 = 7 sales

and so on and so fourth for up to 50 publications.

I though one solution would be to join the 3 order fields and make an array in Crystal, but in truth I dont know how to do that or then how to create my required output.

Any help on a solution would be most appreciated.

Thanks

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 30 Sep 2013 at 5:15am
what comes to mind is to create a command object that is something like:
select order1
from table
union all
select order2
from table
union all
select order3
from table

this will give you a table with just 1 column, which is all the book, and from here the report should be simple...group on the book, suppress the detail and group header and display the count in the group footer.

HTH
IP IP Logged
deanrhurst
Newbie
Newbie
Avatar

Joined: 14 Apr 2010
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote deanrhurst Replybullet Posted: 30 Sep 2013 at 10:34am
Thanks so much Lockwelle, that has worked perfectly :) Many Thanks
IP IP Logged
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.016 seconds.