Example 6: Specifying a table of attachments
In this example we examine how to specify a table of attachments. In this case a record in the Loans module covers the loan of a number of objects in the Catalog module:
Object: (Objects Loaned) attaches to the Catalog module and is a table of attachments. Notes: (Objects Loaned) is an associated table in the Loans module.
The fields loaded are:
Fields |
Back-end name |
---|---|
Loan Direction | InfDirection
|
Loan Purpose | InfLoanPurpose
|
Commencement Date | DatLoanCommencementDate
|
Due Date | DatLoanDueDate
|
Objects | ObjObjectsLoanedRef_tab
|
Objects Notes | ObjObjectNotes_tab
|
For display purposes only, the import data below is presented with column headings listed vertically rather than horizontally. The first row of any tab or comma delimited file must include the column names. The appropriate layout is:
InfDirection
|
InfLoanPurpose
|
DatLoanCommencementDate
|
Outgoing
|
The loan is for research purposes.
|
15-Jan-06
|
Incoming
|
The loan is for an upcoming exhibition.
|
10-Mar-06
|
The import data is:
Column Name (must appear as the first row of the import data file) |
Record 1 |
Record 2 |
---|---|---|
InfDirection
|
Outgoing
|
Incoming
|
InfLoanPurpose
|
The loan is for research purposes.
|
The loan is for an upcoming exhibition.
|
DatLoanCommencementDate
|
15-Jan-06
|
10-Mar-06
|
DatLoanDueDate
|
15-Jan-07
|
10-Jul-06
|
ObjObjectsLoanedRef_tab(1).TitAccessionNo
|
1996.011.024
|
1995.112.138
|
ObjObjectNotes_tab(1)
|
A work on loan from Mr. Tanaka
|
|
ObjObjectsLoanedRef_tab(2).TitAccessionNo
|
1996.011.042
|
1995.112.145
|
ObjObjectNotes_tab(2)
|
||
ObjObjectsLoanedRef_tab(3).TitAccessionNo
|
1995.112.061
|
|
ObjObjectNotes_tab(3)
|
A donations from Mr Sutcliffe
|
ObjObjectsLoaned is both an attachment field (giving us ObjObjectsLoanedRef) and a table (giving us ObjObjectsLoanedRef_tab).
Thus ObjObjectsLoanedRef_tab(1).TitAccessionNo:
- Specifies the first row in the Objects Loaned table.
- When Record 1 is processed a search of the Catalog module will be initiated for an object with an Accession Number of
1996.011.024
.If found, an attachment from the first row in Object: (Objects Loaned) will be made to it.
ObjObjectNotes_tab(1)
specifies the first row in Notes: (Objects Loaned).
The XML for this example is:
<?xml version="1.0" encoding="UTF-8"?>
<table>
<!--First record-->
<tuple>
<!--First the atom fields in the Loans module are specified-->
<atom name="InfDirection">Outgoing</atom>
<atom name="InfLoanPurpose">The loan is for research purposes.</atom>
<atom name="DatLoanCommencementDate">15 January 2006</atom>
<atom name="DatLoanDueDate">15 January 2007</atom>
<!--Next the Object: (Objects Loaned) attachment field is specified. This field attaches to one or more records in the Catalog module (so it's a table).-->
<table name="ObjObjectsLoanedRef_tab">
<tuple>
<atom name="TitAccessionNo">1996.011.024</atom>
</tuple>
<tuple>
<atom name="TitAccessionNo">1996.011.042</atom>
</tuple>
<tuple>
<atom name="TitAccessionNo">1995.112.061</atom>
</tuple>
</table>
<!--This specifies the Notes: (Objects Loaned) table within the Loans module. Keep in mind that if there are several rows in a table and no values in, say, the first row, but values in the subsequent rows, the first tuple would need to be specified with an empty value. Don't forget that when specifying tables there can be only one value per tuple.-->
<table name="ObjObjectNotes_tab">
<tuple>
<atom>A work on loan from Mr. Tanaka</atom>
</tuple>
<tuple>
</tuple>
<tuple>
<atom>A donations from Mr Sutcliffe</atom>
</tuple>
</table>
</tuple>
<!--Second record-->
<tuple>
<atom name="InfDirection">Incoming</atom>
<atom name="InfLoanPurpose">The loan is for an upcoming exhibition.</atom>
<atom name="DatLoanCommencementDate">10 March 2006</atom>
<atom name="DatLoanDueDate">10 July 2006</atom>
<table name="ObjObjectsLoanedRef_tab">
<tuple>
<atom name="TitAccessionNo">1995.112.138</atom>
</tuple>
<tuple>
<atom name="TitAccessionNo">1995.112.145</atom>
</tuple>
</table>
</tuple>
</table>