Solved

One to many

Posted on 2011-02-15
5
436 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
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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 …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 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