WebFOCUS Online Help > Managed Reporting Developer > Creating Reporting Objects > Creating and Customizing a Join in Developer Studio
In this section: |
A join is a temporary connection between two or more data sources that share at least one common field. After you join two data sources, each time WebFOCUS retrieves a record from the first data source (host file), it also retrieves the matching records from the second data source (cross-referenced file). For a full description of joining data sources using the browser, see the Creating Reports With WebFOCUS Language manual. For a full description of joining data sources using Developer Studio, see the Creating Reports With Graphical Tools manual.
You use the Join tool to link data sources. The Join tool provides a graphical method for creating and manipulating joins. Instead of coding a join using the WebFOCUS language, you use the Join tool to drag a field from one data source and link it to a field in another data source.
When you access the Join tool, the window displays a field list for the data source associated with the Reporting Object (which you specified when you created the Reporting Object) and a field list for any data source you add to the window. An icon representing the data type appears before each field name in the Master File.
Note: When joining two FOCUS data sources, the cross-referenced file field must be indexed.
Since every procedure creates a new session on the Reporting Server when it is run, the duration of your connection is always limited to a single procedure. Therefore, any Join issued at the beginning of a procedure will be in effect only for those report requests that are called in the same procedure.
The Join tool provides a graphical method for creating and manipulating Joins. You must specify a host file, then a cross-referenced file to create a join.
You create the Join as an object, separate from any other object or procedure. You are responsible for placing the Join object in the correct position within your procedure (that is, before a Define, Report, or Graph), and for running it. The Join remains active for the entire session, unless you explicitly clear it.
You can open the Join tool from either the toolbar or from a reporting tool. Before the tool opens you will be asked to select a host file.
The Join tool displays both files and, ordinarily, a default Join:
Note: The syntax identifies if the join is an inner, left outer, unique, or non-unique join. When you open a join in the Join tool that was created prior to Version 7, Release 1 you need to specify the join type. For details on specifying the join type (join properties), see the documentation related to the Join Properties dialog box.
When you access the Join tool a toolbar opens below the title bar. You can access the following commands from the toolbar:
Button |
Command |
Description |
---|---|---|
Save |
Saves the join.
| |
New Join |
Creates additional concurrent joins. Note: You may also select New Join from the right-click context menu in the Join window.
| |
Add File |
Selects a cross-referenced file to join to the host file you have already selected. Note: You may also select Add File from the right-click context menu in the Join window.
| |
Clear Join |
Launches the Join Clear window. Note: You may also select Clear Join from the right-click context menu in the Join window.
| |
Run Join |
Runs a join to check syntax. Note: You may also select Run from the right-click context menu in the Join window.
| |
Delete |
Deletes a selected object (table or join). | |
Define Field |
Launches the Join Define in File dialog box to create a virtual field in the host file. | |
|
Create/Edit Selection |
Launches the WHERE Expression Builder to create WHERE criteria and change the join type to a conditional join. This is enabled only when the host table is selected. |
Show/Hide Source Code |
Shows or hides the FOCUS code generated by the Join tool. This is enabled only when the Join link is selected. | |
Toggle Auto Join |
Performs automatic joins within tables. | |
Cascade |
Creates a cascade view of multiple joins (default). | |
Horizontal Tile |
Splits the Join tool horizontally when working with multiple joins. | |
Vertical Tile |
Splits the Join tool vertically when working with multiple joins. |
If you want to define a Join in a procedure:
The Procedure Viewer opens.
The Join tool opens showing a Fields window for the host file that you selected.
Tip: You may also right-click anywhere in the Join window and select Add File from the context menu.
A default Join is created if the host and cross-referenced files share appropriate fields. If a default Join is not created, follow the instructions in Customizing a Join to create your own.
Note: This procedure applies to creating a Join in the Managed Reporting environment.
The WebFOCUS Table List dialog box opens.
The Join tool opens showing a Fields window for the host file that you selected.
The WebFOCUS Table List opens again.
A default Join is created if the host and cross-referenced files share appropriate fields. If a default Join is not created, follow the instructions in Customizing a Join to create your own.
or
or
The Join Properties dialog box opens.
The Field list for each data source being joined displays the field names by default. To help you build meaningful joins you can add information about the listed fields.
The selected information categories appear as headings in the field list for each joined file. Details will appear if the corresponding information is included in the Master File.
When you exit the Join window, you are prompted to save your work. If you save the Join, it is added to the procedure in which it has been created.
Note: You may also select Save from the Developer Studio File menu, or select the Save icon from the Join toolbar.
The Join tool preserves the table sizing and positioning when you re-open the tool. The Join tool displays Joins that use some of the same files in one panel of the Join window. The following two Joins share a host file:
Tip: If the field names you wish to join are different, you must drag and drop the field names to make the connection.
Note: If you close the Join window and then reopen it, the two Joins appear in the same panel.
You can customize an existing Join by changing the files or fields involved. If no default Join was created, you can use the same technique to specify a connection explicitly.
You can also change the Join name, make the Join a single instance, use a virtual field as the Join field, and add tag names to the Join files.
If you delete the host file, all cross-referenced files are automatically deleted.
To delete the existing Join:
You can also select the Join connector line and click the Delete button on the toolbar, or press the Delete key on the keyboard.
The files remain in the window with no connector line between them.
To create your own Join (after deleting the existing Join, if necessary):
A Join connector line appears.
You can leave the Join window open and create another Join by:
You can define up to 63 concurrent Joins that will have a maximum of 64 segments in the new join structure.
By default, each Join is a multiple instance.
To make the Join a single instance:
A default name is automatically assigned to each Join.
You can use the Join name to later clear the Join and to prevent another Join from overwriting it. If you remove the Join name completely, any subsequent unnamed Join will overwrite this Join.
You can also provide a description. This is not used in the Join command. It is used for reference purposes. A comment (-*) is added to the procedure. For example, -*JOINDESC J0.
Note: The following words cannot be used as a Join name: ALL, AND, AS, IN, JOIN, TAG, TO, WITH.
To display a list of joined data source issue the command from the Command Console:
? JOIN
This displays every Join currently in effect.
WebFOCUS |