Importing Print files
Print files are a very popular file type for
importation for the following main reasons:
1.
They
are very easy file types to obtain
2.
They
are familiar to the user, looking exactly the same as the usual
printed report taken from the system
3.
The
user does not normally have to obtain specialist assistance
to obtain them
Data
within IDEA has to conform to two basic rules:
1.
The
data must be tabular
2.
All
elements that constitute a complete record must be on the same
line
Print
files rarely meet the layout that IDEA requires, transactions
are usually grouped, there may be subtotals and grand totals
added, there will be field headers and other information that
must be removed. Print
files therefore can be the most time consuming files to import
with a lot of work necessary on the part of the user.
The
rest of this article is split into three sections:
Section
1: This deals with the basic methodology to be employed in order
to successfully import a print file.
Section2:
Shows how DataImport
(the print report import utility for versions of IDEA up to
v2002) is used.
Section
3: Shows how Report
Reader (the print report import utility for IDEA v2004) is used.
Section
1 – Print Import Methodology
Consider
the following example:

Step
1 – Examine the file
The file
needs to be examined to determine its characteristics - you
need to do two things at this point
- Determine
what the file is and what constitutes a complete record.
The file above
essentially is a list of customer names and numbers, below
each customer are details of all the invoices sent to that
customer, a complete record is made up of the invoice details
on one line together with the customer information in the
‘header’.
- Determine
if the basic format is consistent throughout the file. If
the basic format is consistent it makes the definition and
importation of the file much easier. Most
print files do have a consistent format otherwise making
sense of them on the printed page is not very easy.
Step
2 – Determine what you want the file to look like on importation
to IDEA
This is
the key to building the import template, the most important
thing to bear in mind is IDEA requires all information that
makes up the record, is all together on the same line. For
the example above the first three records would look like this:

Step
3 – Identify and define ‘Detail’ Lines
A detail
line is the last line in the print file that constitutes a complete
record. Usually
it contains the most amount of information. In the example a
detail line would be a line that contains the invoice number,
date, Sales rep no etc.
To Identify
the detail line you must look for something that appears on
all of these types of line, only appears on these lines and
is always the same. It
also helps if it is always in the same position. Usually
the content of a detail line will change from record to record
so picking something that is always the same can be difficult.
However it is possible
to pick up formats so dates are a good option as they usually
will have a fixed format throughout the file.
Once the line has been identified each of the fields
must be defined.
Step
4 – Identify and define ‘Header’ lines that contain
information required
A header
line is a line above the detail line that contains information
required (it is possible to have more than one). In
the example above a header line would be the line that contains
the customer details: name and number.
To identify
and define the fields on the line you basically repeat the process
of identifying a detail line.
Step
5 – save the definition and import to IDEA
It is vital
to save the definition prior to importing this is so you don’t
have to start from scratch if the import does not work as intended.
Section
2 – Using DataImport
In this
section we will look at importing the example print file using
the basic methodology with DataImport.
Step
1 – Examine the file
The best
tool to examine the file with is DataImport itself. Open
the import assistant, select the
file and the Import a
Print File Option. Upon
clicking on Next and then Finish DataImport
will open.
We have
already decided what the file looks like in the basic methodology.
Step
2 – Determine what the file should look like
Again we
have outlined this in the basic methodology.
Step
3 – Identify and define ‘Detail’ lines
In this
case the Detail line is a line that contains the invoice number,
date, Sales rep no etc.
To indicate
the Detail line to DataImport you need to define it as a line
to include, we tell it how to recognise the type of line by
using the format of the date. This
is done by highlighting any detail line date and selecting Include…..Lines…..Define
from the menu. This
will open the Define Include Line dialog and we can then define
a pattern match of two numbers followed by a forward slash followed
by two numbers followed by a forward slash followed by four
numbers :

Once this
has been done we can define the fields. Each
one has to be done individually by highlighting the field and
then selecting Column…..Define from the menu. For
each field you will have to give it a name and type before moving
onto the next one. On
completion of defining the fields you can scan the file visually
to see if it appears to be correct as DataImport will colour
code each field:
Magenta
– Text
Blue –
Numeric
Green –
Date
Any item
that does not match the field type will be coded magenta and
stands out as being different.
Step
4 Identify and define Header lines
This is
basically a repeat of step 3 but this time picking up the line
that contains the customer details. To
identify a header line to DataImport select Tag…..Define
Match String Reference point from the menu. To
define the fields from the header line select Tag…..Line
tag define from the menu. DataImport
will display header lines with the fields having a grey highlight.
A completed DataImport
screen will look like this:

Step
5 – Save definition and import to IDEA
Selecting
File…..Import to IDEA will cause the mask just created to be
saved and import the file to IDEA.
Section
3 – Using Report Reader
In this
section we will look at importing the example print file using
the basic methodology with the Report Reader.
Step
1 – Examine the file
The best
tool to examine the file with is Report Reader itself. Open
the import assistant, select the Print Report option and select
the file. Upon clicking
on next Report Reader will open.
We have
already decided what the file looks like in the basic methodology.
Step
2 – Determine what the file should look like
Again we
have outlined this in the basic methodology.
Step
3 – Identify and define ‘detail’ lines
In this
case the detail line is a line that contains the invoice number,
date, Sales rep no etc. Report Reader uses the concept of ‘Layers’
and the detail line is called the Base Layer, this is the layer
that everything is anchored on.
It is important
that the line you use in Report Reader is the first detail line
in the file. In
this cased we click and drag on the first detail line (it contains
Invoice number 1000058) and we will be asked if we want to create
a new layer. Selecting
Yes will open the Field and Anchor editor:

The first
thing to do is to create the Anchor for the layer by defining
the format of the date in the anchor editor. To
do this we use the Trap buttons on the toolbar. 
On completion
the anchor editor will look like this:

Now the
fields need to be defined. Highlight
each field in turn on the Field Editor, on completion it will
look like this:

Once this
has been done you then save the layer by clicking on the green
tick on the toolbar and you will be presented with the layer
properties dialog:

this is
where you allocate field names and types to each field.
Once this
has been completed you can check the entire file to ensure that
the fields are both wide enough and of the same type by selecting
Scan For Errors, Offsets, widths and types can be adjusted as
necessary.
Step
4 Identify and define Header lines
This is
basically a repeat of step 3 but this time picking up the line
that contains the customer details. On
completion the field and anchor editor will look like this:

As this
is a header layer and we want the fields on this line to be
written down to the detail line(s) below, it is necessary to
select the radio button Fill
Empty Cells with value from previous record for each of
the two fields on this layer. This
is found in the Layer Properties dialog.
Step
5 – Save definition and import to IDEA
Clicking
on the IDEA icon on the toolbar will cause the Template just
created to be saved and take you back to the Import Assistant
where you can complete the import.
Summary
of Print File Method
Method |
DataImport |
Report
Reader |
Examine
the File |
What
Constitutes a complete record
Is the basic format
consistent |
Determine
what it should look like |
All
data elements of the record must be together on the
same line |
Identify
and Define Detail Lines |
Use
the menu option Include…..Lines…..Define.
Each field must
be defined seperately |
This
is the Base Layer and must be the first layer defined.
Fields can be
defined at the same time, names and types allocated
on saving the layer |
Identify
and define Header lines |
Use
the menu option Tag…..Define match string Reference point
to identify the header. Use the menu option
Tag…..Line
Tag define to define the fields. |
Create
a layer just like defining the Base Layer. When defining
fields the option Fill empty cell with value from previous record. Should be selected |
Import
To IDEA |
Use
the menu option File…..Import to IDEA. The file definition (called a mask)
will be saved with a .msk extension so it can be reused |
Select
the IDEA icon on the toolbar. The file definition (called
a template) will be saved with a .jpm extension. |
Using
the above methodology just about all print files can be imported.
The next article
will concentrate upon the more advanced features of DataImport
and Report Reader and dealing with more complicated print files. |