⧼vector-jumptocontent⧽

Dataobjref field: Difference between revisions

From EPrints Documentation
Removed link to API page (just a redirect to this)
Actually leave in as should become available
 
Line 31: Line 31:
Itemref fields are stored in the database as
Itemref fields are stored in the database as
  fieldname INT(11)
  fieldname INT(11)
== API ==
See [[API:EPrints/MetaField/Dataobjref|API page]].


== Examples ==
== Examples ==

Latest revision as of 09:50, 9 July 2024


Description

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

Additional Properties

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

No additional phrases beyond those required for Compound fields.

Database

Itemref fields are stored in the database as

fieldname INT(11)

API

See API page.

Examples

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',
        } ,
    ],
}