Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Database linking problem? null data? Post Reply Post New Topic
Author Message
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Topic: Database linking problem? null data?
     Posted: 19 Jan 2012 at 5:57am
Hello,
 
Hope somebody can help!!
 
I have 2 tables.
 
MANUFACTURER  & TRANSACTIONS
 
they are linked as MANUFACTUER (Primary) >left outer join TRANSACTIONS
 
I want to build a report that shows sales by customer, by manufacturer.
 
but I want it as a template so it always shows the same manufacturer, regardless of which customer is specified.
 
When i specify a TRANSACTIONS customer in the select expert, it removes brands from the grouping.
 
ie;
 
Customer: JOHN SMITH
 
BRAND 1      10 units
BRAND 2      11 units
BRAND 3      20 units
BRAND 4      15 units
BRAND 5       9 units
BRAND 6       30 units
 
the problem I am having is, I group by manufacturer, and if the specified customer hasnt purchased brand 2, 3 & 5
 
it shows this:
 
Customer: JANE JONES
 
BRAND 1      10 units
BRAND 4      15 units
BRAND 6       30 units
 
I want it to show:
 
Customer: JANE JONES
 
BRAND 1      10 units
BRAND 2      0 units
BRAND 3      0 units
BRAND 4      15 units
BRAND 5      0 units
BRAND 6      30 units
 
 
Im guessing its because I am not specifying what to do with the NULL
data from the transaction table.
 
 
Can anyone help me please?
 
I basically want to build a template report, that will always show the same brands regardless of what customer I enter in the parameter.
 
 
 
thanks in advance.
 
Regards,

Michael Jones
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Jan 2012 at 6:04am
are you filtering by anything other than customer id? like a date range?
IP IP Logged
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Posted: 19 Jan 2012 at 6:07am
Yes,

There will be 3 paramters:

{TRNSTK.CUSTOMER} startswith {?Customer}
{TRNSTK.PERIOD} = {?month}
{TRNSTK.YEAR} = {?Year}
Regards,

Michael Jones
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Jan 2012 at 6:11am
So you may have more than one customer appear in the report?
also
do you have a finite number of brands that can be 'hard coded' or do you need it to be dynamic?
IP IP Logged
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Posted: 19 Jan 2012 at 6:20am
Yes, more than 1 customer, BUT, we wont be displaying all the individual customers seperately. simply amalgamating the customers units / values.

so for example we have customers JANE1 to JANE9, we would usually just put {TRNSTK.CUSTOMER} startswith "JANE"

Yes, I have a finite number of brands.

There are about 100, but we are only going to be using about 25, the rest can be catagorized ito "other"
Regards,

Michael Jones
IP IP Logged
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Posted: 19 Jan 2012 at 6:21am
There is no grouping by CUSTOMER.

Group 1 is Manufacturer
 
then at group level we will have UNITS, TURNOVER, PROFIT & PROFIT %
Regards,

Michael Jones
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Jan 2012 at 6:29am
So I thinkt he easiest solution is to not filter your data but rather zero out records that do not meet your conditions.
basically move your select criteria to a formula field
 
if {TRNSTK.CUSTOMER} startswith {?Customer} and
{TRNSTK.PERIOD} = {?month} and
{TRNSTK.YEAR} = {?Year}and
then {TRNSTK.Units} else 0
//guessed at the units name
 
now you can insert a SUM of this formula field at the grouplevel 1 to get total units per Brand
If you want 25 that show to be dynamic based on volume you can use TOP N group options.
Other wise you will have to write a formula for your 20-25 that you want to show and groupng the rest under 'other'. This would replace your field to group on for group 1 (Brand)


Edited by DBlank - 19 Jan 2012 at 6:30am
IP IP Logged
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Posted: 19 Jan 2012 at 6:34am
exactly what I tried. and it seemed to work, but severly affected performance!! tanks for the reply, I will keep on battling and post my results!!
 
thanks!
Regards,

Michael Jones
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Jan 2012 at 6:51am

You can possible hard code a date selection into the report as long as you have at least one record per Brand that is after that date and also you never want an end user to look prior to that date. This would shrink the records you are lookingat and help.

You can go the route of a command or stored proc and imbed your parameters there.
basically for that you would run a query that groups all of your brands into one table, run an inner query (using the params at the query level) to select sales rows that meet your condition and outer join the two together.
The trick  is to get the limited sales data first and then do the outer join to the master list of brands, other wise your select criteria can turn your outer join back into an inner join.


Edited by DBlank - 19 Jan 2012 at 6:53am
IP IP Logged
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