Report Builder Maintenance

Linking Tables

The linking of tables allows detail from more than one table to be used within a Report.  Tables are linked by selection of suitable Fields within each table.  For example the Forms Table is linked to the Current Pupils table using the 'Code' field in the Forms table and the 'Form code' field held in the 'Current Pupils' table.

Many tables are already linked.  The option is however available to manually link together different tables or to amend existing links for an individual Report.

(For further information on Tables and Fields, and the list of Tables which are 'linked',see 'Report Builder - Tables and Fields'.)

'Help' for 'Linking Tables' is divided as follows:

 

 


Linking Tables

About 'Table Links'

In order to create Reports using data contained in more than one Table (View), it is necessary for a link to be established between the tables.  For example if a list of Pupils together with the name of their Form Representative is to be produced, this will require data from both the Current Pupils table and the Forms table.  In order that the correct Form Representative is shown against each Pupil, the two tables must be linked using an appropriate field from both tables.  A system-defined link exists between the Current Pupils Table and the Forms table.  This links uses the 'Code' field in the Forms table and the 'Form Code' field in the Current Pupils table.

Although many links between tables are pre-defined and available by default when creating a Report builder report, it will sometimes be necessary for the user to create or amend the links between tables.  Any User defined links will be specific to the individual report in which the links have been defined.

 


Linking Tables

Existing (System-defined) Links

When a Table is selected for inclusion in the report, the system linked Tables will be highlighted in bold.

See the applicable help topic from the list below, to view the list of tables and the STANDARD table links available in the selected module:

 

 In the example below, the 'Forms' table has been selected (and is displayed in the lower section of the screen).  The tables 'Current Pupils', 'Current Pupils All Years', 'Form Years', 'Past Pupils', 'Prospective Pupils' and 'Staff' are highlighted in bold in the upper section of the screen.  This means that these tables are already 'linked' to the 'Forms' Table and so no link needs to be manually formed if any of these tables are subsequently selected.  

When a linked table is then selected, it is listed in the lower section of the screen with a Join Type of 'Left Outer'.  This means that all records within the first selected table will be listed regardless of not there is a link to the second table, but that only those records in the second table which have a link to the first table will be included.   In the example below, the Current Pupils table is linked to the Forms table with a 'Left Outer' join.  This means that ALL Pupils will be included but only those Forms which are linked to one or more Pupils will be included.  For further information on Join Types, see 'Join Types' below.

 


Linking Tables

Creating new Links

The User may link together tables that are not already linked by default so long as he can find one or more suitable fields within each of the Tables for linking together.

Additional fields may also be linked on tables which are already joined.

The example used below is the new linking of the 'Current Pupil Contacts' table to the 'Staff' table with a join type of 'Inner'.  The effect of linking these two tables together will be to include data in the report only for those Pupil Contacts who are also members of Staff.

Note:  Any manually created Table links will be valid only for the report that is being created.

 

To create new links:

1.

From either the Query Designer or Query Wizard 'Tables' screen, select the first table for inclusion in the Report.

 

 

 

The selected table will be shown in the lower section of the screen, if using Query Designer:

Or, on the right hand side of the screen, if using Query Wizard:

 

 

2.

Select the second table, i.e. the table that is to be linked to the first table.

 

 

 

If a link already exists between the two tables,

the second selected table will be added to the 'Selected' section of the screen.  New fields may be linked, or existing links amended as required - see 'Viewing, Adding, Amending and Deleting Links'.

If  the second selected table is not already linked to the first table,

 the 'Join Table' screen will be given:

In this example, the 'Current Pupil Contacts Table' was selected after first selecting the 'Staff' table.  In the upper section of the screen are listed the available fields in each of the selected tables.  In the lower 'Joined Fields' section of the screen, where applicable, are suggested links between the two tables.  

 

3.

Check the 'Join Type'

 

 

 

 

The default link type is 'Inner Join'.  This means that only those records which are present in both tables will be included on the report.  This may be amended as required  - see 'Join Types' below for information on each type of Join available.

 

4.

Check the default links

 

 

 

Check the links which have been created by default in the lower  'Joined Fields' section of the screen.  

The default links will have been created based on the similarities in the descriptions of the fields in the two tables and will not necessarily be appropriate.

(Assuming that the default '=' type operator is used when joining fields), only those records which have the same data in both tables will be included in the report. For example if the Current Pupil Contacts: 'Birthplace' field is linked to the Staff: Birthplace field then the entry in the Birthplace field on both records must be identical for the Individual to be included on the report.

It is therefore advised that any linked fields for which the data may not be identical in both places are un-linked.

Remove any unwanted links by highlighting the link and selecting .

 

5.

Add new links as required

 

 

 

To add a new link, select the required field for linking from each Table.

In the above example, the 'Name Id' field has been selected from the 'Current Pupil Contacts' table, and the 'Name Id' field in the 'Staff' table has also been selected.

When selections are correct, select .  The selected link will then be displayed in the lower section of the screen. In this example, the Current Pupils Contacts Name Id has been linked to the Staff name Id.  This means that only those Pupil Contacts who also exist as Staff members will be included in the report.

As many links as are required may be entered.  It is however only necessary for a single link to be created.

 

6.

When all detail is correct, select .

 

 

 

 

The table link will be shown in the lower section of the screen, if using Query Designer:

Or, on the right hand side of the screen, if using Query Wizard:

 

7.

Update the newly entered table links

 

 

 

Update the table links by selecting in the bottom right hand corner of the Query Designer Tables screen:

Or, by selecting from the Query Wizard 'Tables' screen:

 

7.

Viewing/Amending links

 

 

 

See 'Viewing, Adding, Amending and Deleting Links 'below.

 

 


Linking Tables

Viewing, Adding, Amending and Deleting Links

1.

Links between Tables may be viewed, added, amended or deleted  from the Query Wizard or the Query Designer 'Tables' screen:

 

 

 

Query Designer

(i) click on the linked table line:

(ii) Click on the to the right of the field, to display the 'Join Table' screen.

 

Query Wizard

(i) click on the linked table

(ii) select to display the 'Join Table' screen.

 

2.

The 'Join Table' screen will be displayed:

 

 

 

The list of currently joined fields is displayed at the bottom of the screen.  These are the existing Table Links.  The following options are now available:

 

3a

Add a new Link

To add a new link, select the required field for linking from each Table.

In the above example, the 'Name Id' field has been selected from the 'Current Pupil Contacts' table, and the 'Name Id' field in the 'Staff' table has also been selected.

When selections are correct, select .  The selected link will then be displayed in the lower section of the screen. In this example, the Current Pupils Contacts Name Id has been linked to the Staff name Id.  This means that only those Pupil Contacts who also exist as Staff members will be included in the report.

As many links as are required may be entered.  It is however only necessary for a single link to be created.

When all required links have been added, select to return to the main Query Wizard/Query Designer 'Tables' screen.  

To ensure that amendments are saved, the button must then be selected on the main Query Designer 'Tables' screen, or, if using Query Wizard, the button should be selected.

 

3b.

Amend an Existing Link

To amend a link, the existing link should first be removed (see 'Delete link' below), and the new link then added (see 'Add a new Link' above).

 

3c.

Delete Link

To remove a link, highlight the applicable link in the lower section of the screen, and select .

 

 

When the list of links is as required, select to return to the main Query Wizard/Query Designer 'Tables' screen.  

To ensure that amendments are saved, the button must then be selected on the main Query Designer 'Tables' screen, or, if using Query Wizard, the button should be selected.

 

 


Linking Tables

Join Types

There are four different 'Join types' which may be used when linking fields from different tables together.  A summary of each together with an example is shown below.  All examples will use the same data to illustrate the difference between the link types.


 

Join Types

Inner Join

If an Inner Join is created, then only those records which are present in both tables will be included.  

For example If the Prospective Pupil Table and Forms Table are linked using an Inner Join (as above), then (i) only those Prospective Pupils linked to a Form, and (ii) only those Forms linked to one or more Prospective Pupils will be included on the report.  

This is illustrated in the example below:


 

Join Types

Full Outer Join

If a Full outer Join is created, then all records which are present in both tables will be included.  

For example If the Prospective Pupil Table and Forms Table are linked using a Full Outer join (as above), then (i) all Prospective Pupils and (ii) all Forms will be included on the report regardless of whether there is a link between the two.  

This is illustrated in the example below:


 

Join Types

Left Outer Join

If a Left Outer Join is created, then all records in the first selected table will be included, but only those records in the second table which are linked to one or more records in the first table.

For example If the Prospective Pupil Table and Forms Table are linked using a left Outer Join (as above), then (i) All Prospective Pupils will be included regardless of whether or not they have been allocated a Form,  (ii) only those Forms which are held against Prospective Pupils will be included.  Any Forms to which no Prospective Pupils have been allocated will not be included on the report.

 This is illustrated in the example below:


 

Join Types

Right outer Join

If a Right Outer Join is created, then all records in the second selected table will be included, but only those records in the first table which are linked to one or more records in the second table.

For example If the Prospective Pupil Table and Forms Table are linked using a Right Outer Join (as above), then (i) All Forms will be included regardless of whether or not any Prospective Pupils have been allocated to that Form,  (ii) only those Prospective Pupils which are held against a Form will be included.  Any Prospective Pupils which have not been allocated to a Form, will not be included on the report.

 This is illustrated in the example below: