Difference between revisions of "Reports Based on Multiple Tables - Overview"

From SmartWiki
Jump to: navigation, search
(Inner and Outer Joins)
Line 1: Line 1:
{{SeqReportPageHeader}}
 
 
 
In this article, you will create one of the most useful reporting features – the ability to relate the information from two tables into a single report.
 
In this article, you will create one of the most useful reporting features – the ability to relate the information from two tables into a single report.
  
In this process you will explore “joining” multiple tables.
+
In this process you will explore “joining” multiple tables.
  
 
In this exercise, you will create a query that uses the company table and the contact table.
 
In this exercise, you will create a query that uses the company table and the contact table.
  
1. Create a '''new report''' with the following values:
+
1. Click the 9-square menu icon on the top right of your page.
  
[[Image:Reps100.png]]
+
:: {{Icon-Menu}}
 
2. '''Save''' the report.
 
  
You will now select the two tables required in the report.
+
2. Under the tab '''Tools, '''select '''Reports. '''
  
3. Scroll to the '''Table''' list.
+
The list of available reports in your system will be displayed.
 +
 
 +
3. Click the '''+ icon '''on the top left, above the [[List View Overview|list]] of reports, to create a '''New Report.'''
  
4. Set the primary table to the '''Companies/Accounts'''.
+
4. The '''New Report '''page is displayed, with fields for you to fill out.
  
[[Image:Reps99.png]]
+
:: [[File:New report pag.png|700px|border]]
 
5. Set the '''Contact''' table as an '''Inner Join'''.
 
  
=Inner and Outer Joins=
+
For this example exercise, fill out the following fields with the corresponding information: 
There are two types of joins supported in [[SmartSimple]] – inner joins and outer joins.
 
  
* An '''inner join''' displays the intersection between the two tables.
+
* '''Report Name: '''List Companies and Contact
 +
* '''Report Description: '''Joins the company and contacts table. 
  
:*This is the most common type of join used, and is the default join type when you [[Adding a Table to a Report|add tables to a report]].
+
5. Click the '''Save '''button.
  
:*When you join the company table and the contact table with an inner join, the report will find the matching record(s) from the contact table related to each company.
+
You will now select the two tables that are required in the report.
  
:*If no match is found, the record from the company is not included in the results.
+
6. Click on the new tab called '''[[Report Recordsets|Recordsets]] '''in the top row of tabs. 
  
:*If multiple results are found in the contact table, the company information will be repeated.
+
:: [[File:Recordsets tab.png|750px|border]] 
  
* An '''outer join''' is very different from an inner join. Instead of limiting results to those in both tables, it limits results to those in the "left" company table.
+
3. Scroll to the '''Table''' list.
  
:*This means that if there are no records in the contact table, a row in the report will still be returned for that company, but with NULL values for each column from contact.
+
4. Set the primary table to the '''Companies/Accounts'''.
  
:1. Open the '''Report Builder'''.
+
[[Image:Reps99.png]]
  
:2. Add the '''following fields''':
+
5. Set the '''Contact''' table as an '''Inner Join'''.
  
:[[Image:Reps98.png]]
+
=Inner and Outer Joins=
+
There are two types of joins supported in [[SmartSimple]] – inner joins and outer joins.
:*The '''Field''' list now contains fields from both tables.
+
 
 +
* An '''inner join''' displays the intersection between the two tables.
  
:3. '''Build''', '''save''', and '''preview''' the report.
+
:* This is the most common type of join used, and is the default join type when you [[Adding a Table to a Report|add tables to a report]].
 +
:* When you join the company table and the contact table with an inner join, the report will find the matching record(s) from the contact table related to each company.
 +
:* If no match is found, the record from the company is not included in the results.
 +
:* If multiple results are found in the contact table, the company information will be repeated.
  
:[[Image:Reps97.png]]
+
* An '''outer join''' is very different from an inner join. Instead of limiting results to those in both tables, it limits results to those in the "left" company table.
 
:*The company name, city, and state information is displayed from the company table for each matching record from the contact table.
 
  
:*No company details will be displayed if there are no contacts.
+
:* This means that if there are no records in the contact table, a row in the report will still be returned for that company, but with NULL values for each column from contact.
 +
1. Open the '''Report Builder'''.
 +
: 2. Add the '''following fields''':
 +
: [[Image:Reps98.png]]
 +
:* The '''Field''' list now contains fields from both tables.
 +
3. '''Build''', '''save''', and '''preview''' the report.
 +
: [[Image:Reps97.png]]
 +
:* The company name, city, and state information is displayed from the company table for each matching record from the contact table.
 +
:* No company details will be displayed if there are no contacts.
  
{{PrevNextStart}} [[Creating a Public – Internet Enabled Report]]
+
{{PrevNextStart}} [[Creating a Public – Internet Enabled Report]]
{{PrevNextMid}} [[Using an Outer Join]] {{PrevNextEnd}}
+
{{PrevNextMid}} [[Using an Outer Join]] {{PrevNextEnd}}
  
 
[[Category:Reports]]
 
[[Category:Reports]]

Revision as of 10:51, 8 July 2019

In this article, you will create one of the most useful reporting features – the ability to relate the information from two tables into a single report.

In this process you will explore “joining” multiple tables.

In this exercise, you will create a query that uses the company table and the contact table.

1. Click the 9-square menu icon on the top right of your page.

052919 MenuIcon.png

2. Under the tab Tools, select Reports. 

The list of available reports in your system will be displayed.

3. Click the + icon on the top left, above the list of reports, to create a New Report.

4. The New Report page is displayed, with fields for you to fill out.

New report pag.png

For this example exercise, fill out the following fields with the corresponding information: 

  • Report Name: List Companies and Contact
  • Report Description: Joins the company and contacts table. 

5. Click the Save button.

You will now select the two tables that are required in the report.

6. Click on the new tab called Recordsets in the top row of tabs. 

Recordsets tab.png 

3. Scroll to the Table list.

4. Set the primary table to the Companies/Accounts.

Reps99.png

5. Set the Contact table as an Inner Join.

Inner and Outer Joins

There are two types of joins supported in SmartSimple – inner joins and outer joins.

  • An inner join displays the intersection between the two tables.
  • This is the most common type of join used, and is the default join type when you add tables to a report.
  • When you join the company table and the contact table with an inner join, the report will find the matching record(s) from the contact table related to each company.
  • If no match is found, the record from the company is not included in the results.
  • If multiple results are found in the contact table, the company information will be repeated.
  • An outer join is very different from an inner join. Instead of limiting results to those in both tables, it limits results to those in the "left" company table.
  • This means that if there are no records in the contact table, a row in the report will still be returned for that company, but with NULL values for each column from contact.

1. Open the Report Builder.

2. Add the following fields:
Reps98.png
  • The Field list now contains fields from both tables.

3. Build, save, and preview the report.

Reps97.png
  • The company name, city, and state information is displayed from the company table for each matching record from the contact table.
  • No company details will be displayed if there are no contacts.




Previous.png Creating a Public – Internet Enabled Report Using an Outer Join Next.png