Solved

One to many

Posted on 2011-02-15
5
433 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now