Jump to content

Dataobjref field

From EPrints Documentation


Description[edit]

This field allows another data object, which belongs to a specified datasetid to be referenced. This is a bit like an Itemref field but allows multiple fields from another data object to be stored with the ID of the data object referenced.

Inheritance[edit]

Additional Properties[edit]

As for Compound fields except for:

Name Default Value Required Description Notes
datasetid n/a YES The ID of the dataset that reference data object belongs.
input_lookup_url lookup/dataobjref NO The CGI script path to use to lookup data objects.
match IN NO How to match this fields values in searches. Different to parent default (EQ).
text_index 1 NO Whether the text for these fields should be indexed. Different to parent default (0).

Required Phrases[edit]

No additional phrases beyond those required for Compound fields.

Database[edit]

Itemref fields are stored in the database as

fieldname INT(11)

API[edit]

See API page.

Examples[edit]

Most basic example. (Captures an associated user title with its ID).

{
    name => 'userid',
    type => 'dataobjref',
    datasetid => 'user',
    fields => [ 
        { 
            sub_name => 'title', 
            type => 'text',
        } 
    ],
}

Capture multiple data object references.

{
    name => 'funders',
    type => 'dataobjref,
    datasetid => 'funder',
    multiple => 1,
    fields => [
        { 
            sub_name => 'name',
            type => 'text' 
        },
    ],
}

Use bespoke lookup URL.

{
    name => 'eprintid',
    type => 'dataobjref',
    datasetid => 'eprint',
    input_lookup_url => 'lookup/mydataobjref',
    fields => [ 
        { 
            sub_name => 'title', 
            type => 'text',
        },
        { 
            sub_name => 'date', 
            type => 'date',
        } ,
    ],
}