Solved

One to many

Posted on 2011-02-15
5
437 Views
Last Modified: 2012-05-11
although this should be basic knowledge of using Crystal Repors I can't figure out how I choose my database links.

I have two tables that I want to link together.
I have the field gl.number in both tables but when I chose to make a report I get the same number of records every time eventhough I chose the fields
incidentsm1.incident.id
incidentsm1.opened.by
incidentsm1.gl.number
operatorm1.name

how do I chose in the Crystal repors menu to make my linke like "One to many"
(One operatorm1.name to many incidentsm1.incident.id)?

 Databaselink
0
Comment
Question by:lkudsk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Author Comment

by:lkudsk
ID: 34897108
Then I search for link relationships in Crystal repors I get this result:

When you link records from one table to another table, the records will typically fall under one of two relationship types: one-to-one or one-to-many.
In this section:
One-to-one relationships
One-to-many relationships

What does "....typically fall under one" means? How do I set what I want - "one to one" or "One to many"?

0
 
LVL 77

Expert Comment

by:peter57r
ID: 34897142
I don't think I understand the problem here.  I think there must be more to it than you have said.

If you run the same report with the same data you should get the same number of records every time.

0
 
LVL 77

Expert Comment

by:peter57r
ID: 34897225
You cannot control the relationship- it is what it is - based on which field is linked to which other field and the properties of those fields.

If you link a unique field in one table to a non-unique field in another then you would expect a one-many relationship; if you link unique field then you would expect a one-one.
Having said that I don't know where CR tells you what relationship has been created, and in terms of creating a report I can't see why it matters.
0
 
LVL 5

Accepted Solution

by:
simonpaul64 earned 250 total points
ID: 34898203
OK - just to cover the basics a one to one relationship between tables means that for each row in tableA there will be a matching row in tableB. Those tables are joined (or linked) by a common key (for example tableA.person_id = tableB.person_id).

A one to many relationship means that for each row in TableA there will be one or more rows (or sometimes none or more rows) in TableB. In that is the case tableB will need all the keys from tableA plus at least one further column as a key.

A simple example of that is an HR system with an employee table (each employee has a unique identifier – say employee_id) and then you want to have the employees give you several postal addresses, (home address, mailing address, summer house – whatever). For the second table (often referred to as a child table. You would have employee_id and address_number (1, 2,3). The address number would be a counter for the employee.

So – if you have a crystal with a query of the employee table and then link the second table for addresses they will have several address rows per employee.

Does that help you understand?
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 250 total points
ID: 34903396
Since you are linking on the GL.Number field that link controls the relationship.

The fields you choose to select from the resulting recordset do not affect the number of records you get.

If you have 1 - operatorm1.name records that can be relateded to many incidentsm1.incident.id records
then you may need to group by the operatorm1.name field and list the related records in the detail section.

If you have more than 1 record in the operatorm1 table for each name value then you may need to link differently or do they all have the same GL.Number value?

Are you filtering the records in any way?

mlmcc

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question