Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Tbl1 Double Link Post Reply Post New Topic
Author Message
gunar
Newbie
Newbie


Joined: 04 Feb 2008
Location: United States
Online Status: Offline
Posts: 12
Quote gunar Replybullet Topic: Tbl1 Double Link
     Posted: 14 Jan 2009 at 11:24am
IP IP Logged
RitaInHood
Newbie
Newbie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 25
Quote RitaInHood Replybullet Posted: 14 Jan 2009 at 1:03pm
What field are you trying to link on?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jan 2009 at 1:04pm
Gunar, your request is a little vague in some details so I am going to have to make some guesses here.
Tbl1 has one row per itemID
Tbl2 also has the itemid field and this is where you are joining to tbl1.
Tbl2 has multiple rows per itemid in order to track changing quantities.
Tbl2 also has an incremental primary key or datetimestamp in order to determine the most recent record (or quantity).
If you are using SQL you can handle this by creating a view to replace table2 that only pulls the maximum value of your datetimestamp/incremental primay key per itemid or you can do suppression in the report based on maximum value on the datetimestamp or incremental primary key fields to hide the values you do not want to display.
see this link for help on the suppression process.
IP IP Logged
gunar
Newbie
Newbie


Joined: 04 Feb 2008
Location: United States
Online Status: Offline
Posts: 12
Quote gunar Replybullet Posted: 14 Jan 2009 at 1:39pm
Originally posted by DBlank

Gunar, your request is a little vague in some details so I am going to have to make some guesses here.
Tbl1 has one row per itemID CORRECT
Tbl2 also has the itemid field and this is where you are joining to tbl1. CORRECT
Tbl2 has multiple rows per itemid in order to track changing quantities. NO ONE ROW PER ITEM ID QTY GETS UPDATED IN REAL TIME
Tbl2 also has an incremental primary key or datetimestamp in order to determine the most recent record (or quantity). FALSE
If you are using SQL you can handle this by creating a view to replace table2 that only pulls the maximum value of your datetimestamp/incremental primay key per itemid or you can do suppression in the report based on maximum value on the datetimestamp or incremental primary key fields to hide the values you do not want to display.
see this link for help on the suppression process.

Sorry I wasn't clear enough before. My problem is I need a report which shows the following:
ItemID (tbl1)  Item Description *(tbl2)
       AccessoryItem ID (tbl1) Qty (tbl2)

The problem starts because tbl1 is just a accessory table holding for example Brake disc 1 (Item ID) goes with brake pad 1 (AccessoryItemID)
. Item ID and Accessory ID are both Items in the tbl2 (one row for each item). I can either link Item ID (tbl1) to Item ID (tbl2) and get only the description, or link accessoryitemid (tbl1) to item id (tbl2) and get the qty.
I want to link both to item id (tbl1) and accessoryitemid (tbl2) to item id (tbl2) to pull my desired information like qty for accessoryitem id and Description for Item ID.

__tbl1________                    _______tbl2_______
Item ID              \_________/ Item ID
AccessoryID      /



IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jan 2009 at 2:09pm

You will have to play with this idea as I don't know your data but here would be an example to try: add table2 to your report twice (it will warn you and insert it as an alias as tablename_1).

tbl1 innerjoined to tbl2 on ItemID and table1 innerjoined to tabl2_alias on accessory_itemid
like this:
table1        table2      table2-alias
itemid<---->itemid
accessoryid<----------->itemid
 
                   
IP IP Logged
gunar
Newbie
Newbie


Joined: 04 Feb 2008
Location: United States
Online Status: Offline
Posts: 12
Quote gunar Replybullet Posted: 14 Jan 2009 at 2:22pm
That works great thank you soooo much 
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