Databases Reference
In-Depth Information
[Total Budget Amount],
Month,
Year
From Budget2011.qvd (qvd);
If we don't add the name of the original table (
Sales
, in the preceding example)
to the
Concatenate
prefix, the new table will be concatenated to the table loaded
immediately before it, no matter what that table is.
We recommend, as a best practice, to always explicitly define concatenation by adding
the name of the target table to the
Concatenate
prefix, even if both tables have the
same structure and would naturally be combined. This is mainly to avoid confusion
and makes it easier for other developers, and yourself, to understand the script.
Concatenating the Employment Statistics table
Now that we've revisited the subject of table concatenation and described the
considerations that we must keep in mind, let's put it into practice. We will be
integrating the
Employment
table into the already designed data model for the
Airline Operations document.
Follow these steps:
1. Make sure the
T_F41SCHEDULE_P1A_EMP.qvd
file is placed into the
Airline
Operations\Data Files\QVDs
folder.
2. Open the
Airline Operations.qvw
document we've been working with.
3. Save the file with another name. Let's call it
Chapter 8_Concatenated
tables.qvw
.
4.
Go to the
Edit Script
window, activate the
Main Data
tab, and click on the
Add new tab
button from the toolbar.
5.
The
Tab Rename
dialog window will appear, in which we will enter
Employment Data
and click on
OK
.
6.
The new tab will be added to the right of the
Main Data
tab, which is
particularly important for our example.
7.
Using the
File Wizard
dialog (click on the
Table Files…
button), create the
Load
statement for the
T_F41SCHEDULE_P1A_EMP.qvd
file. Make sure the
Load
statement is added on the
Employment Data
tab created previously.
8.
Add the new
Quarter
field as a calculated field to address part of what we
discussed about structural asymmetry. The expression we will use for this is:
'Q' & Ceil([Month (#)]/3, 1) as Quarter