Difference between revisions of "Dataobjref field"

From EPrints Documentation
Jump to: navigation, search
(Additional Properties)
(Removed link to API page (just a redirect to this))
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/Itemref|API page]].
 
  
 
== Examples ==
 
== Examples ==

Revision as of 09:42, 9 July 2024

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


Metadata Fields: Arclanguage - Base64 - Bigint - Boolean - Compound - Counter - Dataobjref - Date - Decimal - Email - Fields - Float - Id - Idci - Image - Int - Itemref - Keywords - Langid - Longtext - Longtext_counter - Multilang - Multipart - Name - Namedset - Pagerange - Recaptcha - Recaptcha3 - Relation - Search - Secret - Set - Storable - Subject - Subobject - Text - Time - Timestamp - Url - Uuid


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)

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