Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Problem linking DB's Post Reply Post New Topic
Author Message
AdamField
Groupie
Groupie


Joined: 04 Jun 2009
Online Status: Offline
Posts: 88
Quote AdamField Replybullet Topic: Problem linking DB's
    Posted: 31 Dec 2009 at 4:34am
Hey guys,
 
I'm designing a report that would display sales over a period of time.
 
i have currently 3 DB's i'm working with
1:[Artikel]  containing a lot of fields but using only 1 in this problem
 
a_volgnr witch containts the code we have for a article (a product we sell)
 
 
the 2e and 3e DB are called LEU-hisarel and GEN-hisarel
both containing the same fields but from 2 different shops
 
both are linked with [Artikel] on the field a_volgnr
both contain the following info that i use
 
a_volgnr   |   h_datum    |       h_aantal    |
 
i also have 2 parameters that i give in when running the report  beying
StartDate and StopDate
 
the info in LEU-hisarel and GEN-Hisarel is sales history of that shop
 
now i would like to see somthing like this
 
i give in the date's for example  sales between 2009-11-01 and 2009-11-30 for all my artikels
 
@ the moment i have 1 detail section when i place h_aantal in and in the section expert i place ({LEU-hisarel.h_datum} <= {?StartDate} OR {LEU-hisarel.h_datum}>= {?StopDate})
 
this works like a charm and gives me all the sales per a_volgnr over the period of time that i entered
 
I can group this result on a_volgnr and use a sum(h_aantal) to give me totals for every a_volgnr
 
the problem comes when i try to add the second shop
 
i tried making a second detail section and entering the h_aantal from the other DB there but from that moment on he gives me totaly wrong info on the sales
 
In reality i have to add 5 shops in total (starting with 2 is hard enough :p)
 
Any idee how i could make this working ?
 
Much appriciated to take the time to read this already !!
 
Adam
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 Dec 2009 at 7:30am
So you have in this case 4 tables. 2 tables are identical but capture the sales from a distinct shop and eventually you need to include even more shops/tables.
 
Since they are all the same structure how about using a UNION to put all the various shop tables together into one table and then use that?


Edited by DBlank - 31 Dec 2009 at 7:32am
IP IP Logged
AdamField
Groupie
Groupie


Joined: 04 Jun 2009
Online Status: Offline
Posts: 88
Quote AdamField Replybullet Posted: 04 Jan 2010 at 2:55am
Hey DBlank,
 
How can i find out what the sale per shop is then ?
 
also i don't see how i can mix them, would it be somthing like this then ?
 
DB1
a_volgnr     /     h_datum    /    h_aantal    /   documentnr
 
305604            2009/12/01          4                  09120001
307204            2009/12/01          1                  09120001
368742            2009/12/01          1                  09120002
305604            2009/12/01          2                  09120003
100305            2009/12/01          1                  09120003
 
 
DB2
a_volgnr     /     h_datum    /    h_aantal    /   documentnr
 
854721            2009/12/01          4                  09120001
632541            2009/12/01          1                  09120002
205635            2009/12/01          1                  09120003
523548            2009/12/01          2                  09120003
305604            2009/12/01          1                  09120004
 
In this example in DB1 there is a article i sold 4 times on the first document and 2 time on the 3e one
 
If you would do a union of them into 1 DB
 
it would give me
305604            2009/12/01          4                  09120001
307204            2009/12/01          1                  09120001
368742            2009/12/01          1                  09120002
305604            2009/12/01          2                  09120003
100305            2009/12/01          1                  09120003
854721            2009/12/01          4                  09120001
632541            2009/12/01          1                  09120002
205635            2009/12/01          1                  09120003
523548            2009/12/01          2                  09120003
305604            2009/12/01          1                  09120004
 
and i just add a extra field in the db called SHOP where i put shop1 shop2 ... to sepperate the sales ?
 
Tnx already for the feedback !!
 
 
ps: Happy new year all :p
 
 
Adam
 
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.030 seconds.