Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula on a left outer join table Post Reply Post New Topic
Author Message
jspri
Newbie
Newbie


Joined: 04 Nov 2009
Online Status: Offline
Posts: 1
Quote jspri Replybullet Topic: Formula on a left outer join table
     Posted: 04 Nov 2009 at 3:58am
Hi All,

I have a problem with a formula.

Table1 - lots
lotID
warehouseID
QTYonHAND
QTYReservered

Table3 - Invoice
invoiceID

Table2 - invoicelines
invoicelinesID
invoiceID
lotID
quantity

Table 1 has all of the information i need except the quantity on invoicelines. This is only used if that line is associated with the LotID and may or may not be linked.

therefore, I can get Qty On Hand, and Qty Reserved, but errors when I include Quantity on Invoice.

Error makes QTYonHAND to appear as many times an Invoice with that lot ID is found.

I realise this is not an easy error to explain but would appreciate any help. I have included a isnull statement, which makes the Quantity field correct, but multiples QTYonHAND for each Quantity found.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 04 Nov 2009 at 6:19am
what sounds like is happening that when an lotid is found, then all the invoice lines in table2 are joined to the table1, and you are summing the value of the qtyOnHand, which in this case is incorrect, you just want to display the value. 
 
If you need to sum multiple values, I would create a formula or a running total that would only increment once per lot id.
 
You would have this issue regardless of the join type.
 
HTH
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