• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 444
  • Last Modified:

One to many

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
lkudsk
Asked:
lkudsk
2 Solutions
 
lkudskAuthor Commented:
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
 
peter57rCommented:
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
 
peter57rCommented:
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
 
simonpaul64Commented:
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
 
mlmccCommented:
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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now